adobe/brackets

View on GitHub

Showing 3,294 of 3,294 total issues

Function LiveCSSDocumentModule has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

define(function LiveCSSDocumentModule(require, exports, module) {
    "use strict";

    var _               = require("thirdparty/lodash"),
        CSSUtils        = require("language/CSSUtils"),
Severity: Minor
Found in src/LiveDevelopment/MultiBrowserImpl/documents/LiveCSSDocument.js - About 2 hrs 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

File main.js has 267 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: Minor
Found in src/LiveDevelopment/main.js - About 2 hrs to fix

    Function _getInitialDocFromCurrent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _getInitialDocFromCurrent() {
            var doc = _getCurrentDocument(),
                refPath,
                i;
    
    
    Severity: Major
    Found in src/LiveDevelopment/LiveDevelopment.js - About 2 hrs to fix

      Function _getInitialDocFromCurrent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _getInitialDocFromCurrent() {
              var doc = DocumentManager.getCurrentDocument(),
                  refPath,
                  i;
      
      
      Severity: Major
      Found in src/LiveDevelopment/LiveDevMultiBrowser.js - About 2 hrs to fix

        Function getHealthData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getHealthData() {
                var result = new $.Deferred(),
                    oneTimeHealthData = {};
        
                oneTimeHealthData.snapshotTime = Date.now();
        Severity: Major
        Found in src/extensions/default/HealthData/HealthDataManager.js - About 2 hrs to fix

          Function domManip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              domManip: function( args, table, callback ) {
                  var results, first, fragment, parent,
                      value = args[0],
                      scripts = [];
          
          

            Function addMatch has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function addMatch(match) {
                        // Pull off the character index
                        var c = match.index;
                        var newPoints = 0;
            
            
            Severity: Major
            Found in src/utils/StringMatch.js - About 2 hrs to fix

              Function _getTagAttributes has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function _getTagAttributes(editor, constPos) {
                      var pos, ctx, ctxPrev, ctxNext, ctxTemp, tagName, exclusionList = [], shouldReplace;
              
                      pos = $.extend({}, constPos);
                      ctx = TokenUtils.getInitialContext(editor._codeMirror, pos);
              Severity: Major
              Found in src/language/XMLUtils.js - About 2 hrs to fix

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

                                if (sOptions.options.cwd) {
                                    try {
                                        if (fs.lstatSync(sOptions.options.cwd).isDirectory(sOptions.options.cwd)) {
                                            cwd = sOptions.options.cwd;
                                        }
                Severity: Major
                Found in src/languageTools/LanguageClient/ServerUtils.js and 1 other location - About 2 hrs to fix
                src/languageTools/LanguageClient/ServerUtils.js on lines 289..295

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

                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

                            if (!event.metaKey && !event.ctrlKey) {
                                selectee.$element.removeClass('ui-selected');
                                selectee.selected = false;
                                selectee.$element.addClass('ui-unselecting');
                                selectee.unselecting = true;
                src/extensions/default/JavaScriptQuickEdit/unittest-files/jquery-ui/ui/jquery.ui.selectable.js on lines 207..217

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

                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

                                if (sOptions.options.cwd) {
                                    try {
                                        if (fs.lstatSync(sOptions.options.cwd).isDirectory(sOptions.options.cwd)) {
                                            cwd = sOptions.options.cwd;
                                        }
                Severity: Major
                Found in src/languageTools/LanguageClient/ServerUtils.js and 1 other location - About 2 hrs to fix
                src/languageTools/LanguageClient/ServerUtils.js on lines 339..345

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

                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

                                    if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                                        selectee.$element.removeClass('ui-selected');
                                        selectee.selected = false;
                
                                        selectee.$element.addClass('ui-unselecting');
                src/extensions/default/JavaScriptQuickEdit/unittest-files/jquery-ui/ui/jquery.ui.selectable.js on lines 103..112

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

                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

                                it("should commit valid changes made in the input field on the change event", function () {
                                    makeUI("#abcdef");
                                    colorEditor.$colorValue.val("#fedcba");
                                    colorEditor.$colorValue.trigger("change");
                                    expect(tinycolor(colorEditor.getColor()).toHexString()).toBe("#fedcba");
                Severity: Major
                Found in src/extensions/default/InlineColorEditor/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/InlineColorEditor/unittests.js on lines 1335..1340

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

                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

                        case KeyEvent.DOM_VK_UP:
                            step = event.shiftKey ? step * STEP_MULTIPLIER : step;
                            if (alpha < 100) {
                                hsv.a = (alpha + step) >= 1 ? 1 : alpha + step;
                                this.setColorAsHsv(hsv);
                Severity: Major
                Found in src/extensions/default/InlineColorEditor/ColorEditor.js and 1 other location - About 2 hrs to fix
                src/extensions/default/InlineColorEditor/ColorEditor.js on lines 763..769

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

                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

                        case KeyEvent.DOM_VK_DOWN:
                            step = event.shiftKey ? step * STEP_MULTIPLIER : step;
                            if (alpha > 0) {
                                hsv.a = (alpha - step) <= 0 ? 0 : alpha - step;
                                this.setColorAsHsv(hsv);
                Severity: Major
                Found in src/extensions/default/InlineColorEditor/ColorEditor.js and 1 other location - About 2 hrs to fix
                src/extensions/default/InlineColorEditor/ColorEditor.js on lines 770..776

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

                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

                                it("should commit valid changes made in the input field on the input event", function () {
                                    makeUI("#abcdef");
                                    colorEditor.$colorValue.val("#fedcba");
                                    colorEditor.$colorValue.trigger("input");
                                    expect(tinycolor(colorEditor.getColor()).toHexString()).toBe("#fedcba");
                Severity: Major
                Found in src/extensions/default/InlineColorEditor/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/InlineColorEditor/unittests.js on lines 1341..1346

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

                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 expectCursorAt(pos) {
                            var selection = testEditor.getSelection();
                            expect(fixPos(selection.start)).toEqual(fixPos(selection.end));
                            expect(fixPos(selection.start)).toEqual(fixPos(pos));
                        }
                Severity: Major
                Found in src/extensions/default/SVGCodeHints/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/PrefsCodeHints/unittests.js on lines 150..154

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

                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

                            it("should hint in middle of value in muliple options with empty query", function () {
                                // Between xMinYMid and meet
                                testDocument.replaceRange(" ", {line: 2, ch: 59});
                                testEditor.setCursorPos({ line: 2, ch: 60});
                                var hintLint = expectHints(SVGCodeHints.hintProvider);
                Severity: Major
                Found in src/extensions/default/SVGCodeHints/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/SVGCodeHints/unittests.js on lines 421..427

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

                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

                            it("should hint in middle of value in multiple options with a query", function () {
                                // Between xMinYMid and meet
                                testDocument.replaceRange(" sli", {line: 2, ch: 59});
                                testEditor.setCursorPos({line: 2, ch: 63});
                                var hintLint = expectHints(SVGCodeHints.hintProvider);
                Severity: Major
                Found in src/extensions/default/SVGCodeHints/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/SVGCodeHints/unittests.js on lines 413..419

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

                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 expectCursorAt(pos) {
                            var selection = testEditor.getSelection();
                            expect(fixPos(selection.start)).toEqual(fixPos(selection.end));
                            expect(fixPos(selection.start)).toEqual(fixPos(pos));
                        }
                Severity: Major
                Found in src/extensions/default/PrefsCodeHints/unittests.js and 1 other location - About 2 hrs to fix
                src/extensions/default/SVGCodeHints/unittests.js on lines 119..123

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

                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

                Severity
                Category
                Status
                Source
                Language