adobe/brackets

View on GitHub
src/language/XMLUtils.js

Summary

Maintainability
D
1 day
Test Coverage

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

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

        function _getTagAttributeValue(editor, pos) {
            var ctx, tagName, attrName, exclusionList = [], offset, textBefore, textAfter;
    
            ctx = TokenUtils.getInitialContext(editor._codeMirror, pos);
            offset = TokenUtils.offsetInToken(ctx);
    Severity: Minor
    Found in src/language/XMLUtils.js - About 1 hr to fix

      Function getTagInfo has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function getTagInfo(editor, pos) {
              var ctx, offset, tagAttrs, tagAttrValue;
      
              ctx = TokenUtils.getInitialContext(editor._codeMirror, pos);
              offset = TokenUtils.offsetInToken(ctx);
      Severity: Minor
      Found in src/language/XMLUtils.js - About 1 hr to fix

        Function _createTagInfo has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            function _createTagInfo(token, tokenType, offset, exclusionList, tagName, attrName, shouldReplace) {
        Severity: Major
        Found in src/language/XMLUtils.js - About 50 mins to fix

          Avoid too many return statements within this function.
          Open

                          return _createTagInfo(ctx.token, TOKEN_VALUE, offset, tagAttrValue.exclusionList, tagAttrValue.tagName, tagAttrValue.attrName);
          Severity: Major
          Found in src/language/XMLUtils.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return _createTagInfo();
            Severity: Major
            Found in src/language/XMLUtils.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return {
                          tagName: tagName,
                          exclusionList: exclusionList,
                          shouldReplace: shouldReplace
                      };
              Severity: Major
              Found in src/language/XMLUtils.js - About 30 mins to fix

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

                            if (ctxPrev.token.type === "tag") {
                                tagName = ctxPrev.token.string;
                                if (TokenUtils.movePrevToken(ctxPrev)) {
                                    if (ctxPrev.token.type === "tag bracket" && ctxPrev.token.string === "<") {
                                        break;
                Severity: Major
                Found in src/language/XMLUtils.js and 1 other location - About 2 hrs to fix
                src/language/XMLUtils.js on lines 204..212

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

                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 (ctx.token.type === "tag") {
                                tagName = ctx.token.string;
                                if (TokenUtils.movePrevToken(ctx)) {
                                    if (ctx.token.type === "tag bracket" && ctx.token.string === "<") {
                                        break;
                Severity: Major
                Found in src/language/XMLUtils.js and 1 other location - About 2 hrs to fix
                src/language/XMLUtils.js on lines 114..122

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

                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 (ctx.token.type === "string" &&
                                    /^['"]$/.test(ctx.token.string.substr(-1, 1)) &&
                                    ctx.token.string.length !== 1 &&
                                    ctx.token.end === pos.ch) {
                                return _createTagInfo();
                Severity: Major
                Found in src/language/XMLUtils.js and 1 other location - About 2 hrs to fix
                src/language/JSONUtils.js on lines 232..235

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

                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