adobe/brackets

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

Summary

Maintainability
D
2 days
Test Coverage

Function getHints has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    SVGCodeHints.prototype.getHints = function (implicitChar) {
        var hints = [], query, tagInfo, attributes = [], options = [], index, isMultiple, tagSpecificOptions;

        tagInfo  = XMLUtils.getTagInfo(this.editor, this.editor.getCursorPos());
        this.tagInfo = tagInfo;
Severity: Major
Found in src/extensions/default/SVGCodeHints/main.js - About 2 hrs to fix

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

        SVGCodeHints.prototype.insertHint = function (completion) {
            var tagInfo = this.tagInfo,
                pos     = this.editor.getCursorPos(),
                start   = {line: -1, ch: -1},
                end     = {line: -1, ch: -1},
    Severity: Major
    Found in src/extensions/default/SVGCodeHints/main.js - About 2 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                      if (tagSpecificOptions) {
                          options = tagSpecificOptions.attribOptions;
                          isMultiple = tagSpecificOptions.multiple;
                      } else if (attributeData[tagInfo.attrName]) {
                          options = attributeData[tagInfo.attrName].attribOptions;
      Severity: Major
      Found in src/extensions/default/SVGCodeHints/main.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if (!isMultiple && /\s+/.test(tagInfo.token.string)) {
                            return null;
                        }
        Severity: Major
        Found in src/extensions/default/SVGCodeHints/main.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (tagInfo.exclusionList.indexOf(option) === -1) {
                                  var match = StringMatch.stringMatch(option.text || option, query, stringMatcherOptions);
                                  if (match) {
                                      if (option.color) {
                                          match.color = option.color;
          Severity: Major
          Found in src/extensions/default/SVGCodeHints/main.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (match) {
                                        return match;
                                    }
            Severity: Major
            Found in src/extensions/default/SVGCodeHints/main.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                              if (!tagData.tags[tagInfo.tagName] && !(attributeData[tagInfo.attrName] || tagSpecificOptions)) {
                                  return null;
                              }
              Severity: Major
              Found in src/extensions/default/SVGCodeHints/main.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                        return null;
                Severity: Major
                Found in src/extensions/default/SVGCodeHints/main.js - About 30 mins to fix

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

                      function formatHints(hints, query) {
                          var hasColorSwatch = hints.some(function (token) {
                              return token.color;
                          });
                  
                  
                  Severity: Major
                  Found in src/extensions/default/SVGCodeHints/main.js and 1 other location - About 1 day to fix
                  src/extensions/default/CSSCodeHints/main.js on lines 193..223

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

                  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 (tagInfo.exclusionList.indexOf(option) === -1) {
                                          var match = StringMatch.stringMatch(option.text || option, query, stringMatcherOptions);
                                          if (match) {
                                              if (option.color) {
                                                  match.color = option.color;
                  Severity: Major
                  Found in src/extensions/default/SVGCodeHints/main.js and 1 other location - About 1 hr to fix
                  src/extensions/default/CSSCodeHints/main.js on lines 313..322

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

                  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