adobe/brackets

View on GitHub

Showing 3,294 of 3,294 total issues

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

            it("should NOT list attribute value hints to the right of a closing single quote", function () {
                testDocument.replaceRange(" dir='ltr'", { line: 6, ch: 5 });  // insert dir='ltr' between <h3 and id

                testEditor.setCursorPos({ line: 4, ch: 15 });       // set cursor right after dir='ltr'
                expectNoHints(HTMLCodeHints.attrHintProvider);
Severity: Major
Found in src/extensions/default/HTMLCodeHints/unittests.js and 1 other location - About 2 hrs to fix
src/extensions/default/HTMLCodeHints/unittests.js on lines 399..404

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

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 NOT list attribute value hints to the right of a closing double quote", function () {
                testDocument.replaceRange(" dir=\"ltr\"", { line: 7, ch: 4 });  // insert dir="ltr" between <p and >

                testEditor.setCursorPos({ line: 7, ch: 14 });       // set cursor right after dir="ltr"
                expectNoHints(HTMLCodeHints.attrHintProvider);
Severity: Major
Found in src/extensions/default/HTMLCodeHints/unittests.js and 1 other location - About 2 hrs to fix
src/extensions/default/HTMLCodeHints/unittests.js on lines 405..410

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

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

    unwrap: function() {
        return this.parent().each(function() {
            if ( !jQuery.nodeName( this, "body" ) ) {
                jQuery( this ).replaceWith( this.childNodes );
            }
src/thirdparty/jquery-2.1.3.js on lines 8390..8396

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

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

            it("should filter out color names appropriately", function () {
                testEditor.setCursorPos({ line: 100, ch: 27 }); // after border-left-color
                var hintList = expectHints(CSSCodeHints.cssPropHintProvider);
                verifyAttrHints(hintList, "deeppink"); // first hint should be deeppink
                verifyAllValues(hintList, ["deeppink", "deepskyblue"]);
Severity: Major
Found in src/extensions/default/CSSCodeHints/unittests.js and 2 other locations - About 2 hrs to fix
src/extensions/default/CSSCodeHints/unittests.js on lines 637..642
src/extensions/default/CSSCodeHints/unittests.js on lines 678..683

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

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 (text[i + 1] === "}") {
                    braceStack.pop();
                    if (braceStack.length === 0 && tagStack.length === 0) {
                        range = {
                            from: openPos.to,
src/extensions/default/CodeFolding/foldhelpers/handlebarsFold.js on lines 156..168

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

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 list parameter hint for an array parameter", function () {
                var testPos = { line: 184, ch: 12 };
                testEditor.setCursorPos(testPos);
                runs(function () {
                    expectParameterHint([{name: "other", type: "Array.<Object>"}], -1);
Severity: Major
Found in src/extensions/default/JavaScriptCodeHints/unittests.js and 1 other location - About 2 hrs to fix
src/extensions/default/JavaScriptCodeHints/unittests.js on lines 1203..1210

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

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 if (tag[0] === "/" &&
                                   (_.last(tagStack) === tag.substr(1) || _.last(tagStack) === "*" + tag.substr(1))) {
                            tagStack.pop();
                            if (tagStack.length === 0 && braceStack.length === 0) {
                                range = {
src/extensions/default/CodeFolding/foldhelpers/handlebarsFold.js on lines 173..182

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

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

        DocumentManager.getDocumentForPath(newFilePath)
            .done(function (newDoc) {
                newDoc.on("languageChanged.quickFindDefinition", function () {
                    var changedLanguageId = LanguageManager.getLanguageForPath(newDoc.file.fullPath).getId();
                    _setMenuItemStateForLanguage(changedLanguageId);
Severity: Major
Found in src/search/QuickOpen.js and 1 other location - About 2 hrs to fix
src/features/FindReferencesManager.js on lines 167..173

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

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 list parameter hint for record type annotation", function () {
                var testPos = { line: 178, ch: 25 };

                testEditor.setCursorPos(testPos);
                runs(function () {
Severity: Major
Found in src/extensions/default/JavaScriptCodeHints/unittests.js and 1 other location - About 2 hrs to fix
src/extensions/default/JavaScriptCodeHints/unittests.js on lines 1232..1238

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

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 _requestTernServer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function _requestTernServer(commandConfig) {
    var file, text, offset,
        request = commandConfig,
        type = request.type;
    if (config.debug) {
Severity: Minor
Found in src/JSUtils/node/TernNodeDomain.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

Function watchPath has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function watchPath(path, ignored, _watcherMap) {

    var ignoreMatcher = buildMatcher(ignored);
    var closing = false;

Severity: Minor
Found in src/filesystem/impls/appshell/node/CSharpWatcher.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

Function getSearchMatches has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

function getSearchMatches(contents, queryExpr) {
    if (!contents) {
        return;
    }
    // Quick exit if not found or if we hit the limit
Severity: Minor
Found in src/search/node/FindInFilesDomain.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

Function updateFoldInfo has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateFoldInfo(cm, from, to) {
        var minFoldSize = prefs.getSetting("minFoldSize") || 2;
        var opts = cm.state.foldGutter.options;
        var fade = prefs.getSetting("hideUntilMouseover");
        var $gutter = $(cm.getGutterElement());
Severity: Major
Found in src/extensions/default/CodeFolding/foldhelpers/foldgutter.js - About 2 hrs to fix

    Function _destroy has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _destroy: function() {
            if ( this.xhr ) {
                this.xhr.abort();
            }
    
    

      Function _refreshValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _refreshValue: function() {
              var lastValPercent, valPercent, value, valueMin, valueMax,
                  oRange = this.options.range,
                  o = this.options,
                  that = this,

        Function _mouseStart has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _mouseStart: function(event) {
                var that = this;
        
                this.opos = [event.pageX, event.pageY];
        
        

          Function _processTabs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _processTabs: function() {
                  var that = this;
          
                  this.tablist = this._getList()
                      .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )

            Function keydown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        keydown: function( event ) {
                            if ( this.element.prop( "readOnly" ) ) {
                                suppressKeyPress = true;
                                suppressInput = true;
                                suppressKeyPressRepeat = true;

              Function done has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function done() {
                  config.autorun = true;
              
                  // Log the last module results
                  if ( config.currentModule ) {

                Function getContents has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Directory.prototype.getContents = function (callback) {
                        if (this._contentsCallbacks) {
                            // There is already a pending call for this directory's contents.
                            // Push the new callback onto the stack and return.
                            this._contentsCallbacks.push(callback);
                Severity: Major
                Found in src/filesystem/Directory.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language