angular/angular.js

View on GitHub
src/ng/directive/input.js

Summary

Maintainability
F
1 wk
Test Coverage

File input.js has 664 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/* global
  VALID_CLASS: false,
  INVALID_CLASS: false,
Severity: Major
Found in src/ng/directive/input.js - About 1 day to fix

    Function rangeInputType has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

    function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
      badInputChecker(scope, element, attr, ctrl, 'range');
      numberFormatterParser(ctrl);
      baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
    
    
    Severity: Minor
    Found in src/ng/directive/input.js - About 6 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 rangeInputType has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
      badInputChecker(scope, element, attr, ctrl, 'range');
      numberFormatterParser(ctrl);
      baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
    
    
    Severity: Major
    Found in src/ng/directive/input.js - About 4 hrs to fix

      Function createDateInputType has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createDateInputType(type, regexp, parseDate, format) {
        return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
          badInputChecker(scope, element, attr, ctrl, type);
          baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
      
      
      Severity: Major
      Found in src/ng/directive/input.js - About 3 hrs to fix

        Function baseInputType has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
          var type = lowercase(element[0].type);
        
          // In composition mode, users are still inputting intermediate text buffer,
          // hold the listener until composition is done.
        Severity: Minor
        Found in src/ng/directive/input.js - About 3 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 dynamicDateInputType has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
            badInputChecker(scope, element, attr, ctrl, type);
            baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
        
            var isTimeType = type === 'time' || type === 'datetimelocal';
        Severity: Major
        Found in src/ng/directive/input.js - About 3 hrs to fix

          Function createDateInputType has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          function createDateInputType(type, regexp, parseDate, format) {
            return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
              badInputChecker(scope, element, attr, ctrl, type);
              baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
          
          
          Severity: Minor
          Found in src/ng/directive/input.js - About 3 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 baseInputType has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
            var type = lowercase(element[0].type);
          
            // In composition mode, users are still inputting intermediate text buffer,
            // hold the listener until composition is done.
          Severity: Major
          Found in src/ng/directive/input.js - About 2 hrs to fix

            Function numberInputType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
              badInputChecker(scope, element, attr, ctrl, 'number');
              numberFormatterParser(ctrl);
              baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
            
            
            Severity: Minor
            Found in src/ng/directive/input.js - About 1 hr to fix

              Function isValidForStep has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

              function isValidForStep(viewValue, stepBase, step) {
                // At this point `stepBase` and `step` are expected to be non-NaN values
                // and `viewValue` is expected to be a valid stringified number.
                var value = Number(viewValue);
              
              
              Severity: Minor
              Found in src/ng/directive/input.js - About 1 hr 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 createDateParser has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createDateParser(regexp, mapping) {
                return function(iso, previousDate) {
                  var parts, map;
              
                  if (isDate(iso)) {
              Severity: Minor
              Found in src/ng/directive/input.js - About 1 hr to fix

                Function hiddenInputBrowserCacheDirective has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var hiddenInputBrowserCacheDirective = function() {
                  var valueProperty = {
                    configurable: true,
                    enumerable: false,
                    get: function() {
                Severity: Minor
                Found in src/ng/directive/input.js - About 1 hr to fix

                  Function checkboxInputType has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
                  Severity: Major
                  Found in src/ng/directive/input.js - About 1 hr to fix

                    Function numberInputType has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
                    Severity: Major
                    Found in src/ng/directive/input.js - About 1 hr to fix

                      Function radioInputType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function radioInputType(scope, element, attr, ctrl) {
                        var doTrim = !attr.ngTrim || trim(attr.ngTrim) !== 'false';
                        // make the name unique, if not defined
                        if (isUndefined(attr.name)) {
                          element.attr('name', nextUid());
                      Severity: Minor
                      Found in src/ng/directive/input.js - About 55 mins 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 urlInputType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                      Severity: Minor
                      Found in src/ng/directive/input.js - About 45 mins to fix

                        Function hiddenInputBrowserCacheDirective has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        var hiddenInputBrowserCacheDirective = function() {
                          var valueProperty = {
                            configurable: true,
                            enumerable: false,
                            get: function() {
                        Severity: Minor
                        Found in src/ng/directive/input.js - About 45 mins 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 emailInputType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                        Severity: Minor
                        Found in src/ng/directive/input.js - About 45 mins to fix

                          Function ngValueDirective has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          var ngValueDirective = function() {
                            /**
                             *  inputs use the value attribute as their default value if the value property is not set.
                             *  Once the value property has been set (by adding input), it will not react to changes to
                             *  the value attribute anymore. Setting both attribute and property fixes this behavior, and
                          Severity: Minor
                          Found in src/ng/directive/input.js - About 45 mins 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 textInputType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                          Severity: Minor
                          Found in src/ng/directive/input.js - About 45 mins to fix

                            Function baseInputType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                            Severity: Minor
                            Found in src/ng/directive/input.js - About 45 mins to fix

                              Function rangeInputType has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function rangeInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                              Severity: Minor
                              Found in src/ng/directive/input.js - About 45 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                  if (isDefined(attr.step) || attr.ngStep) {
                                    var stepVal = attr.step || $parse(attr.ngStep)(scope);
                                    var parsedStepVal = parseNumberAttrVal(stepVal);
                                
                                    ctrl.$validators.step = function(modelValue, viewValue) {
                                Severity: Major
                                Found in src/ng/directive/input.js - About 40 mins to fix

                                  Function badInputChecker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function badInputChecker(scope, element, attr, ctrl, parserName) {
                                  Severity: Minor
                                  Found in src/ng/directive/input.js - About 35 mins to fix

                                    Function parseConstantExpr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    function parseConstantExpr($parse, context, name, expression, fallback) {
                                    Severity: Minor
                                    Found in src/ng/directive/input.js - About 35 mins to fix

                                      Function weekParser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function weekParser(isoWeek, existingDate) {
                                        if (isDate(isoWeek)) {
                                          return isoWeek;
                                        }
                                      
                                      
                                      Severity: Minor
                                      Found in src/ng/directive/input.js - About 35 mins 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 countDecimals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      function countDecimals(num) {
                                        var numString = num.toString();
                                        var decimalSymbolIndex = numString.indexOf('.');
                                      
                                        if (decimalSymbolIndex === -1) {
                                      Severity: Minor
                                      Found in src/ng/directive/input.js - About 25 mins 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

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

                                          if (isDefined(attr.max) || attr.ngMax) {
                                            var maxVal = attr.max || $parse(attr.ngMax)(scope);
                                            var parsedMaxVal = parseObservedDateValue(maxVal);
                                      
                                            ctrl.$validators.max = function(value) {
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 6 hrs to fix
                                      src/ng/directive/input.js on lines 1544..1558

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

                                      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 (isDefined(attr.min) || attr.ngMin) {
                                            var minVal = attr.min || $parse(attr.ngMin)(scope);
                                            var parsedMinVal = parseObservedDateValue(minVal);
                                      
                                            ctrl.$validators.min = function(value) {
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 6 hrs to fix
                                      src/ng/directive/input.js on lines 1560..1574

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

                                      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 (hasMinAttr) {
                                          minVal = parseNumberAttrVal(attr.min);
                                      
                                          ctrl.$validators.min = supportsRange ?
                                            // Since all browsers set the input to a valid value, we don't need to check validity
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 3 hrs to fix
                                      src/ng/directive/input.js on lines 1828..1840

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

                                      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 (hasMaxAttr) {
                                          maxVal = parseNumberAttrVal(attr.max);
                                      
                                          ctrl.$validators.max = supportsRange ?
                                            // Since all browsers set the input to a valid value, we don't need to check validity
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 3 hrs to fix
                                      src/ng/directive/input.js on lines 1814..1826

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

                                      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

                                      function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                                        // Note: no badInputChecker here by purpose as `url` is only a validation
                                        // in browsers, i.e. we can always read out input.value even if it is not valid!
                                        baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
                                        stringBasedInputType(ctrl);
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 2 hrs to fix
                                      src/ng/directive/input.js on lines 1947..1957

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

                                      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

                                      function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                                        // Note: no badInputChecker here by purpose as `url` is only a validation
                                        // in browsers, i.e. we can always read out input.value even if it is not valid!
                                        baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
                                        stringBasedInputType(ctrl);
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 2 hrs to fix
                                      src/ng/directive/input.js on lines 1935..1945

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

                                      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

                                          attr.$observe('min', function(val) {
                                            if (val !== minVal) {
                                              parsedMinVal = parseNumberAttrVal(val);
                                              minVal = val;
                                              // TODO(matsko): implement validateLater to reduce number of validations
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 1 hr to fix
                                      src/ng/directive/input.js on lines 1757..1764

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

                                      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

                                          attr.$observe('max', function(val) {
                                            if (val !== maxVal) {
                                              parsedMaxVal = parseNumberAttrVal(val);
                                              maxVal = val;
                                              // TODO(matsko): implement validateLater to reduce number of validations
                                      Severity: Major
                                      Found in src/ng/directive/input.js and 1 other location - About 1 hr to fix
                                      src/ng/directive/input.js on lines 1739..1746

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

                                      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

                                          ctrl.$validators.min = function(modelValue, viewValue) {
                                            return ctrl.$isEmpty(viewValue) || isUndefined(parsedMinVal) || viewValue >= parsedMinVal;
                                          };
                                      Severity: Minor
                                      Found in src/ng/directive/input.js and 1 other location - About 40 mins to fix
                                      src/ng/directive/input.js on lines 1753..1755

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

                                      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

                                          ctrl.$validators.max = function(modelValue, viewValue) {
                                            return ctrl.$isEmpty(viewValue) || isUndefined(parsedMaxVal) || viewValue <= parsedMaxVal;
                                          };
                                      Severity: Minor
                                      Found in src/ng/directive/input.js and 1 other location - About 40 mins to fix
                                      src/ng/directive/input.js on lines 1735..1737

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

                                      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