adobe/brackets

View on GitHub
src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js

Summary

Maintainability
D
1 day
Test Coverage

File RefactoringUtils.js has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
* Copyright (c) 2013 - 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/extensions/default/JavaScriptRefactoring/RefactoringUtils.js - About 4 hrs to fix

    Function getAllScopes has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function getAllScopes(ast, scope, fullText) {
            var curScope = scope;
            var cnt = 0;
            var scopes = [];
    
    
    Severity: Major
    Found in src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js - About 2 hrs to fix

      Avoid deeply nested control flow statements.
      Open

                              if (classNode) {
                                  // Class Declaration found add it to scopes
                                  var temp = curScope.prev;
                                  var newScope = {};
                                  newScope.isClass = true;
      Severity: Major
      Found in src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js - About 45 mins to fix

        Avoid too many return statements within this function.
        Open

                return false;
        Severity: Major
        Found in src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return parentExpn;
          Severity: Major
          Found in src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js - About 30 mins to fix

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

                var Acorn         = brackets.getModule("thirdparty/acorn/dist/acorn"),
                    ASTWalker     = brackets.getModule("thirdparty/acorn/dist/walk"),
                    MessageIds    = brackets.getModule("JSUtils/MessageIds"),
                    _             = brackets.getModule("thirdparty/lodash"),
                    AcornLoose    = brackets.getModule("thirdparty/acorn/dist/acorn_loose"),
            src/extensions/default/CommandLineTool/main.js on lines 29..34
            src/extensions/default/HealthData/HealthDataPreview.js on lines 27..35

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

            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

                                    curScope.name = "function starting with " +
                                        fullText.substr(
                                            curScope.originNode.body.start,
                                            Math.min(
                                                FUNCTION_BODY_PREFIX_LENGTH,
            src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js on lines 390..397

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

            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

                                    curScope.name = "function starting with " +
                                        fullText.substr(
                                            curScope.originNode.body.start,
                                            Math.min(
                                                FUNCTION_BODY_PREFIX_LENGTH,
            src/extensions/default/JavaScriptRefactoring/RefactoringUtils.js on lines 402..409

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

            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

                        fileInfo = {
                            type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
                            name: path,
                            offsetLines: 0,
                            text: ScopeManager.filterText(session.getJavascriptText())
            src/extensions/default/JavaScriptRefactoring/RenameIdentifier.js on lines 60..65

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

            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