angular/angular.js

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

Summary

Maintainability
F
4 days
Test Coverage

Function ngRepeatDirective has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {
  var NG_REMOVED = '$$NG_REMOVED';
  var ngRepeatMinErr = minErr('ngRepeat');

  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
Severity: Minor
Found in src/ng/directive/ngRepeat.js - About 1 day 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 ngRepeatDirective has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {
  var NG_REMOVED = '$$NG_REMOVED';
  var ngRepeatMinErr = minErr('ngRepeat');

  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
Severity: Major
Found in src/ng/directive/ngRepeat.js - About 6 hrs to fix

    Function ngRepeatCompile has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        compile: function ngRepeatCompile($element, $attr) {
          var expression = $attr.ngRepeat;
          var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);
    
          var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
    Severity: Major
    Found in src/ng/directive/ngRepeat.js - About 5 hrs to fix

      Function ngRepeatLink has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
      
              // Store a list of elements from previous run. This is a hash where key is the item from the
              // iterator, and the value is objects with following properties.
              //   - scope: bound scope
      Severity: Major
      Found in src/ng/directive/ngRepeat.js - About 3 hrs to fix

        Function ngRepeatAction has 92 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
                  var index, length,
                      previousNode = $element[0],     // node that cloned nodes should be inserted after
                                                      // initialized to the comment node anchor
                      nextNode,
        Severity: Major
        Found in src/ng/directive/ngRepeat.js - About 3 hrs to fix

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

            var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
          Severity: Major
          Found in src/ng/directive/ngRepeat.js - About 50 mins to fix

            There are no issues that match your filters.

            Category
            Status