adobe/brackets

View on GitHub
src/extensions/default/DebugCommands/main.js

Summary

Maintainability
F
3 days
Test Coverage

File main.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2012 - 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/extensions/default/DebugCommands/main.js - About 1 day to fix

    Function _formatPref has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _formatPref(prefName,  prefItem, indentLevel) {
    
            // check for validity of the parameters being passed
            if (!prefItem || indentLevel < 0 || !prefName || !prefName.length) {
                return "";
    Severity: Major
    Found in src/extensions/default/DebugCommands/main.js - About 2 hrs to fix

      Function _loadDefaultPrefs has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _loadDefaultPrefs(prefsPath, deferredPromise) {
      
              var defaultPrefsPath = defaultPreferencesFullPath,
                  file             = FileSystem.getFileForPath(defaultPrefsPath);
      
      
      Severity: Minor
      Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

        Function handleSwitchLanguage has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function handleSwitchLanguage() {
                var stringsPath = FileUtils.getNativeBracketsDirectoryPath() + "/nls";
        
                FileSystem.getDirectoryForPath(stringsPath).getContents(function (err, entries) {
                    if (!err) {
        Severity: Minor
        Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

          Function _getPrefType has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _getPrefType(prefItem) {
          
                  var finalPrefType = "undefined";
          
                  if (prefItem) {
          Severity: Minor
          Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

            Function _openPrefFilesInSplitView has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function _openPrefFilesInSplitView(prefsPath, defaultPrefsPath, deferredPromise) {
            
                    var currScheme         = MainViewManager.getLayoutScheme(),
                        file               = FileSystem.getFileForPath(prefsPath),
                        defaultPrefsFile   = FileSystem.getFileForPath(defaultPrefsPath),
            Severity: Minor
            Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

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

                  function _formatBasicPref(prefItem, prefName, tabIndentStr) {
              
                      if (!prefItem || typeof (prefName) !== "string" || _getPrefType(prefItem) === "object") {
                          // return empty string in case of
                          // object or pref is not defined.
              Severity: Minor
              Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

                Function handleShowPerfData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function handleShowPerfData() {
                        var templateVars = {
                            delimitedPerfData: PerfUtils.getDelimitedPerfData(),
                            perfData: []
                        };
                Severity: Minor
                Found in src/extensions/default/DebugCommands/main.js - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (_prefType !== _initialType) {
                                              _prefType = _initialType;
                                          }
                  Severity: Major
                  Found in src/extensions/default/DebugCommands/main.js - About 45 mins to fix

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

                                    FileUtils.writeText(file, _prefsString, true)
                                        .done(function () {
                                            recomputeDefaultPrefs = false;
                                            _openPrefFilesInSplitView(prefsPath, defaultPrefsPath, deferredPromise);
                                        }).fail(function (error) {
                    Severity: Major
                    Found in src/extensions/default/DebugCommands/main.js and 1 other location - About 2 hrs to fix
                    src/extensions/default/DebugCommands/main.js on lines 681..689

                    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

                                                FileUtils.writeText(file, prefsString, true)
                                                    .done(function () {
                                                        recomputeDefaultPrefs = false;
                                                        _openPrefFilesInSplitView(prefsPath, defaultPrefsPath, deferredPromise);
                                                    }).fail(function (error) {
                    Severity: Major
                    Found in src/extensions/default/DebugCommands/main.js and 1 other location - About 2 hrs to fix
                    src/extensions/default/DebugCommands/main.js on lines 710..718

                    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

                    There are no issues that match your filters.

                    Category
                    Status