adobe/brackets

View on GitHub
src/view/MainViewManager.js

Summary

Maintainability
F
4 days
Test Coverage

File MainViewManager.js has 884 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/MainViewManager.js - About 2 days to fix

    Function _loadViewState has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _loadViewState(e) {
            // file root is appended for each project
            var panes,
                promises = [],
                context = { location : { scope: "user",
    Severity: Major
    Found in src/view/MainViewManager.js - About 3 hrs to fix

      Function _open has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _open(paneId, file, optionsIn) {
              var result = new $.Deferred(),
                  options = optionsIn || {};
      
              function doPostOpenActivation() {
      Severity: Major
      Found in src/view/MainViewManager.js - About 2 hrs to fix

        Function _saveViewState has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function _saveViewState() {
                function _computeSplitPercentage() {
                    var available,
                        used;
        
        
        Severity: Minor
        Found in src/view/MainViewManager.js - About 1 hr to fix

          Function _initialLayout has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _initialLayout(forceRefresh) {
                  var panes = Object.keys(_panes),
                      size = 100 / panes.length;
          
                  _.forEach(_panes, function (pane) {
          Severity: Minor
          Found in src/view/MainViewManager.js - About 1 hr to fix

            Function _mergePanes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _mergePanes() {
                    if (_panes.hasOwnProperty(SECOND_PANE)) {
            
                        var firstPane = _panes[FIRST_PANE],
                            secondPane = _panes[SECOND_PANE],
            Severity: Minor
            Found in src/view/MainViewManager.js - About 1 hr to fix

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

                  function _createPaneIfNecessary(paneId) {
                      var newPane;
              
                      if (!_panes.hasOwnProperty(paneId)) {
                          newPane = new Pane(paneId, _$el);
              Severity: Minor
              Found in src/view/MainViewManager.js - About 1 hr to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (pane.id !== _activePaneId) {
                                            // activate the pane which will put focus in the pane's doc
                                            setActivePaneId(pane.id);
                                            // reset the focus to the inline editor
                                            current.focus();
                Severity: Major
                Found in src/view/MainViewManager.js - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ((rows < 1) || (rows > 2) || (columns < 1) || (columns > 2) || (columns === 2 && rows === 2)) {
                              console.error("setLayoutScheme unsupported layout " + rows + ", " + columns);
                              return false;
                          }
                  Severity: Major
                  Found in src/view/MainViewManager.js - About 40 mins to fix

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

                            uniqueFileList.forEach(function (file) {
                                if (_findFileInMRUList(pane.id, file) !== -1) {
                                    console.log(file.fullPath + " duplicated in mru list");
                                }
                                _mruList.push(_makeMRUListEntry(file, pane.id));
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 2 hrs to fix
                    src/view/MainViewManager.js on lines 1538..1543

                    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 78.

                    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

                                        fileList.forEach(function (file) {
                                            if (_findFileInMRUList(pane.id, file) !== -1) {
                                                console.log(file.fullPath + " duplicated in mru list");
                                            }
                                            _mruList.push(_makeMRUListEntry(file, pane.id));
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 2 hrs to fix
                    src/view/MainViewManager.js on lines 752..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 78.

                    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

                        function _swapWorkingSetListIndexes(paneId, index1, index2) {
                            var pane = _getPane(paneId);
                    
                            pane.swapViewListIndexes(index1, index2);
                            exports.trigger("workingSetSort", pane.id);
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 1 hr to fix
                    src/view/MainViewManager.js on lines 904..910

                    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 70.

                    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

                        function _moveWorkingSetItem(paneId, fromIndex, toIndex) {
                            var pane = _getPane(paneId);
                    
                            pane.moveWorkingSetItem(fromIndex, toIndex);
                            exports.trigger("workingSetSort", pane.id);
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 1 hr to fix
                    src/view/MainViewManager.js on lines 919..925

                    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 70.

                    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

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

                            do {
                                index = _.findIndex(_mruList, compare);
                                if (index !== -1) {
                                    _mruList.splice(index, 1);
                                }
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 1 hr to fix
                    src/view/MainViewManager.js on lines 873..878

                    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 56.

                    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

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

                            do {
                                index = _.findIndex(_mruList, compare);
                                if (index !== -1) {
                                    _mruList.splice(index, 1);
                                }
                    Severity: Major
                    Found in src/view/MainViewManager.js and 1 other location - About 1 hr to fix
                    src/view/MainViewManager.js on lines 788..793

                    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 56.

                    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

                            return _.findIndex(_mruList, function (record) {
                                return (record.file.fullPath === file.fullPath && record.paneId === paneId);
                            });
                    Severity: Minor
                    Found in src/view/MainViewManager.js and 1 other location - About 35 mins to fix
                    src/view/MainViewManager.js on lines 273..275

                    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

                            var index = _.findIndex(_mruList, function (record) {
                                return (record.file.fullPath === file.fullPath && record.paneId !== paneId);
                            });
                    Severity: Minor
                    Found in src/view/MainViewManager.js and 1 other location - About 35 mins to fix
                    src/view/MainViewManager.js on lines 261..263

                    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