adobe/brackets

View on GitHub
src/view/Pane.js

Summary

Maintainability
F
3 days
Test Coverage

File Pane.js has 730 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2014 - present Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
Severity: Major
Found in src/view/Pane.js - About 1 day to fix

    Function Pane has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function Pane(id, $container) {
            this._initialize();
    
            // Setup the container and the element we're inserting
            var self = this,
    Severity: Major
    Found in src/view/Pane.js - About 5 hrs to fix

      Function moveView has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Pane.prototype.moveView = function (file, destinationPane, destinationIndex) {
              var self = this,
                  openNextPromise = new $.Deferred(),
                  result = new $.Deferred();
      
      
      Severity: Minor
      Found in src/view/Pane.js - About 1 hr to fix

        Function showView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Pane.prototype.showView = function (view) {
                if (this._currentView && this._currentView === view) {
                    this._setViewVisibility(this._currentView, true);
                    this.updateLayout(true);
                    return;
        Severity: Minor
        Found in src/view/Pane.js - About 1 hr to fix

          Function focus has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Pane.prototype.focus = function () {
                  var current = window.document.activeElement,
                      self = this;
          
                  // Helper to focus the current view if it can
          Severity: Minor
          Found in src/view/Pane.js - About 1 hr to fix

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                Pane.prototype.findInViewList = function (fullPath) {
                    return _.findIndex(this._viewList, function (file) {
                        return file.fullPath === fullPath;
                    });
                };
            Severity: Major
            Found in src/view/Pane.js and 2 other locations - About 1 hr to fix
            src/view/Pane.js on lines 741..745
            src/view/Pane.js on lines 753..757

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                Pane.prototype.findInViewListMRUOrder = function (fullPath) {
                    return _.findIndex(this._viewListMRUOrder, function (file) {
                        return file.fullPath === fullPath;
                    });
                };
            Severity: Major
            Found in src/view/Pane.js and 2 other locations - About 1 hr to fix
            src/view/Pane.js on lines 730..734
            src/view/Pane.js on lines 741..745

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                Pane.prototype.findInViewListAddedOrder = function (fullPath) {
                    return _.findIndex(this._viewListAddedOrder, function (file) {
                        return file.fullPath === fullPath;
                    });
                };
            Severity: Major
            Found in src/view/Pane.js and 2 other locations - About 1 hr to fix
            src/view/Pane.js on lines 730..734
            src/view/Pane.js on lines 753..757

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$headerText", {
                        get: function () {
                            return $headerText;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 364..371
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$header", {
                        get: function () {
                            return $header;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 364..371
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$el", {
                        get: function () {
                            return $el;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 364..371
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$content", {
                        get: function () {
                            return $content;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$container", {
                        get: function () {
                            return $container;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 364..371

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$headerCloseBtn", {
                        get: function () {
                            return $headerCloseBtn;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 346..353
            src/view/Pane.js on lines 364..371
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 7 locations. Consider refactoring.
            Open

                    Object.defineProperty(this,  "$headerFlipViewBtn", {
                        get: function () {
                            return $headerFlipViewBtn;
                        },
                        set: function () {
            Severity: Major
            Found in src/view/Pane.js and 6 other locations - About 40 mins to fix
            src/view/Pane.js on lines 319..326
            src/view/Pane.js on lines 328..335
            src/view/Pane.js on lines 337..344
            src/view/Pane.js on lines 355..362
            src/view/Pane.js on lines 364..371
            src/view/Pane.js on lines 373..380

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 48.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                            if (needOpenNextFile) {
                                // this will destroy the current view
                                this._execOpenFile(fullPath)
                                    .fail(function () {
                                        // the FILE_OPEN op failed so destroy the current view
            Severity: Minor
            Found in src/view/Pane.js and 1 other location - About 35 mins to fix
            src/view/Pane.js on lines 1403..1413

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if (needOpenNextFile) {
                            // A successful open will destroy the current view
                            this._execOpenFile(fullPath)
                                .fail(function () {
                                    // the FILE_OPEN op failed so destroy the current view
            Severity: Minor
            Found in src/view/Pane.js and 1 other location - About 35 mins to fix
            src/view/Pane.js on lines 1355..1362

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status