adobe/brackets

View on GitHub

Showing 3,294 of 3,294 total issues

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

            var installPromise = Async.doSequentially(result.installZips, function (zip) {
                autoExtensions[zip.info.metadata.name] = zip.info.metadata.version;
                return Package.installFromPath(zip.file.fullPath);
            });
Severity: Major
Found in src/extensibility/ExtensionManager.js and 1 other location - About 1 hr to fix
src/extensibility/ExtensionManager.js on lines 863..866

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

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 (!CommandManager.get(Commands.VIEW_INCREASE_FONT_SIZE).getEnabled()) {
                // If one is disabled then they all are disabled, so enable them all
                CommandManager.get(Commands.VIEW_INCREASE_FONT_SIZE).setEnabled(true);
                CommandManager.get(Commands.VIEW_DECREASE_FONT_SIZE).setEnabled(true);
                CommandManager.get(Commands.VIEW_RESTORE_FONT_SIZE).setEnabled(true);
Severity: Major
Found in src/view/ViewCommandHandlers.js and 1 other location - About 1 hr to fix
src/view/ViewCommandHandlers.js on lines 382..387

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

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

        } else {
            // No current document so disable all of the Font Size commands
            CommandManager.get(Commands.VIEW_INCREASE_FONT_SIZE).setEnabled(false);
            CommandManager.get(Commands.VIEW_DECREASE_FONT_SIZE).setEnabled(false);
            CommandManager.get(Commands.VIEW_RESTORE_FONT_SIZE).setEnabled(false);
Severity: Major
Found in src/view/ViewCommandHandlers.js and 1 other location - About 1 hr to fix
src/view/ViewCommandHandlers.js on lines 376..381

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

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 ( oRange === "max" && this.orientation === "horizontal" ) {
                this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
            }
src/extensions/default/JavaScriptQuickEdit/unittest-files/jquery-ui/ui/jquery.ui.slider.js on lines 628..630

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

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

Function extractAndValidateFiles has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function extractAndValidateFiles(zipPath, extractDir, options, callback) {
    var unzipper = new DecompressZip(zipPath);
    unzipper.on("error", function (err) {
        // General error to report for problems reading the file
        callback(null, {
Severity: Minor
Found in src/extensibility/node/package-validator.js - About 1 hr to fix

    Function openLine has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function openLine(editor, direction) {
            editor = editor || EditorManager.getFocusedEditor();
            if (!editor) {
                return;
            }
    Severity: Minor
    Found in src/editor/EditorCommandHandlers.js - About 1 hr to fix

      Function setInlineContent has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          InlineTextEditor.prototype.setInlineContent = function (doc, startLine, endLine) {
              var self = this;
      
              // Destroy the previous editor if we had one and clear out the filename info.
              if (this.editor) {
      Severity: Minor
      Found in src/editor/InlineTextEditor.js - About 1 hr to fix

        Function performCleanup has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function performCleanup(requester, filesToCache, notifyBack) {
                var currentRequester = requester || "";
                function filterFilesAndNotify(files, filesToCacheArr, notifyBackToBrackets) {
                    files.forEach(function (file) {
                        var fileExt = path.extname(path.basename(file));
        Severity: Minor
        Found in src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js - About 1 hr to fix

          Function _createFileEntries has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function _createFileEntries($mrofList) {
                  var data, fileEntry, $link, $newItem;
                  // Iterate over the MROF list and create the pop over UI items
          
                  // If we are in split view we might want to show the panes corresponding to the entries
          Severity: Minor
          Found in src/extensions/default/NavigationAndHistory/main.js - About 1 hr to fix

            Function init has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init(domainManager) {
                    if (!domainManager.hasDomain("AutoUpdate")) {
                        domainManager.registerDomain("AutoUpdate", {
                            major: 0,
                            minor: 1
            Severity: Minor
            Found in src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js - About 1 hr to fix

              Function _determineDate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _determineDate: function(inst, date, defaultDate) {
                      var offsetNumeric = function(offset) {
                          var date = new Date();
                          date.setDate(date.getDate() + offset);
                          return date;

                Function statement has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function statement(noindent) {
                        var i = indent, r, s = scope, t = nexttoken;
                
                        if (t.id === ";") {
                            advance(";");

                  Function _toggle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _toggle: function( event, eventData ) {
                          var that = this,
                              toShow = eventData.newPanel,
                              toHide = eventData.oldPanel;
                  
                  

                    Function data has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        data: function( key, value ) {
                            var parts, part, attr, name, l,
                                elem = this[0],
                                i = 0,
                                data = null;

                      Function CHILD has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              CHILD: function( elem, match ) {
                                  var first, last,
                                      doneName, parent, cache,
                                      count, diff,
                                      type = match[1],

                        Function render has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                render: function () {
                                    var fullname = this.props.name,
                                        extension = LanguageManager.getCompoundFileExtension(fullname),
                                        name = _getName(fullname, extension);
                        
                        
                        Severity: Minor
                        Found in src/project/FileTreeView.js - About 1 hr to fix

                          Function buildFragment has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              buildFragment: function( elems, context, scripts, selection ) {
                                  var elem, tmp, tag, wrap, contains, j,
                                      fragment = context.createDocumentFragment(),
                                      nodes = [],
                                      i = 0,
                          Severity: Minor
                          Found in src/thirdparty/jquery-2.1.3.js - About 1 hr to fix

                            Function hashJSObj has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function hashJSObj(obj) {
                                var hash;
                                if (usingWeakMap) {
                                  hash = weakMap.get(obj);
                                  if (hash !== undefined) {
                            Severity: Minor
                            Found in src/thirdparty/immutable.js - About 1 hr to fix

                              Function RemoteAgent has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                              define(function RemoteAgent(require, exports, module) {
                                  "use strict";
                              
                                  var LiveDevelopment     = require("LiveDevelopment/LiveDevelopment"),
                                      EventDispatcher     = require("utils/EventDispatcher"),
                              Severity: Minor
                              Found in src/LiveDevelopment/Agents/RemoteAgent.js - About 1 hr to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function JSDocumentModule has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                              define(function JSDocumentModule(require, exports, module) {
                                  "use strict";
                              
                                  var EventDispatcher = require("utils/EventDispatcher"),
                                      Inspector       = require("LiveDevelopment/Inspector/Inspector"),
                              Severity: Minor
                              Found in src/LiveDevelopment/Documents/JSDocument.js - About 1 hr to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Severity
                              Category
                              Status
                              Source
                              Language