src/ng/directive/ngRepeat.js
Function ngRepeatDirective
has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring. Open
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) {
- Read upRead up
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
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) {
Function ngRepeatCompile
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
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*$/);
Function ngRepeatLink
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Function ngRepeatAction
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
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,
Function updateScope
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {