adobe/brackets

View on GitHub
src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js

Summary

Maintainability
C
1 day
Test Coverage

Function _getValidStepsParams has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function _getValidStepsParams(match) {
        var param,
            def = [ "5", "end" ],
            params = def,
            oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards

    Function _getValidBezierParams has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function _getValidBezierParams(match) {
            var param,
                // take ease-in-out as default value in case there are no params yet (or they are invalid)
                def = [ ".42", "0", ".58", "1" ],
                oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards

      Function bezierCurveMatch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function bezierCurveMatch(str, lax) {
              var match;
      
              // First look for any cubic-bezier().
              match = str.match(BEZIER_CURVE_VALID_REGEX);

        Function stepsMatch has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function stepsMatch(str, lax) {
                var match;
        
                // First look for any steps().
                match = str.match(STEPS_VALID_REGEX);

          Avoid deeply nested control flow statements.
          Open

                                  if (param.value < 0) {
                                      match[i] = "0";
                                  } else if (param.value > 1) {
                                      match[i] = "1";
                                  }
          Severity: Major
          Found in src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                            return _tagMatch(str.match(LINEAR_LAX_REGEX), BEZIER);
            Severity: Major
            Found in src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

                                  return _tagMatch(match, BEZIER);
                  Severity: Major
                  Found in src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js - About 30 mins to fix

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

                            if (match) {
                                match = _getValidStepsParams(match);
                                if (match && _validateStepsParams(match)) {
                                    return _tagMatch(match, STEP);
                                } else { // this should not happen!
                    src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js on lines 325..332

                    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

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

                            if (match) {
                                match = _getValidBezierParams(match);
                                if (match && _validateCubicBezierParams(match)) {
                                    return _tagMatch(match, BEZIER);
                                } else { // this should not happen!
                    src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js on lines 394..401

                    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

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

                            if (lax) {
                                // For lax parsing, just look for the keywords
                                match = str.match(EASE_LAX_REGEX);
                                if (match) {
                                    return _tagMatch(match, BEZIER);
                    src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js on lines 404..417

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

                    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 (lax) {
                                // For lax parsing, just look for the keywords
                                match = str.match(STEP_LAX_REGEX);
                                if (match) {
                                    return _tagMatch(match, STEP);
                    src/extensions/default/InlineTimingFunctionEditor/TimingFunctionUtils.js on lines 335..348

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

                    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 (x1.value < 0 || x1.value > 1 || x2.value < 0 || x2.value > 1) {
                                return false;
                            }
                    src/LiveDevelopment/Agents/DOMAgent.js on lines 167..174

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

                    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