angular/angular.js

View on GitHub
src/Angular.js

Summary

Maintainability
F
1 wk
Test Coverage

File Angular.js has 834 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/* We need to tell ESLint what variables are being exported */
/* exported
  angular,
Severity: Major
Found in src/Angular.js - About 2 days to fix

    Function copy has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

    function copy(source, destination, maxDepth) {
      var stackSource = [];
      var stackDest = [];
      maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN;
    
    
    Severity: Minor
    Found in src/Angular.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 equals has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    function equals(o1, o2) {
      if (o1 === o2) return true;
      if (o1 === null || o2 === null) return false;
      // eslint-disable-next-line no-self-compare
      if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
    Severity: Minor
    Found in src/Angular.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 forEach has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    function forEach(obj, iterator, context) {
      var key, length;
      if (obj) {
        if (isFunction(obj)) {
          for (key in obj) {
    Severity: Minor
    Found in src/Angular.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 baseExtend has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    function baseExtend(dst, objs, deep) {
      var h = dst.$$hashKey;
    
      for (var i = 0, ii = objs.length; i < ii; ++i) {
        var obj = objs[i];
    Severity: Minor
    Found in src/Angular.js - About 5 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 copy has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function copy(source, destination, maxDepth) {
      var stackSource = [];
      var stackDest = [];
      maxDepth = isValidObjectMaxDepth(maxDepth) ? maxDepth : NaN;
    
    
    Severity: Major
    Found in src/Angular.js - About 4 hrs to fix

      Function bootstrap has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function bootstrap(element, modules, config) {
        if (!isObject(config)) config = {};
        var defaultConfig = {
          strictDi: false
        };
      Severity: Major
      Found in src/Angular.js - About 2 hrs to fix

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

        function bindJQuery() {
          var originalCleanData;
        
          if (bindJQueryFired) {
            return;
        Severity: Minor
        Found in src/Angular.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 equals has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function equals(o1, o2) {
          if (o1 === o2) return true;
          if (o1 === null || o2 === null) return false;
          // eslint-disable-next-line no-self-compare
          if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
        Severity: Minor
        Found in src/Angular.js - About 1 hr to fix

          Function forEach has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function forEach(obj, iterator, context) {
            var key, length;
            if (obj) {
              if (isFunction(obj)) {
                for (key in obj) {
          Severity: Minor
          Found in src/Angular.js - About 1 hr to fix

            Function bootstrap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            function bootstrap(element, modules, config) {
              if (!isObject(config)) config = {};
              var defaultConfig = {
                strictDi: false
              };
            Severity: Minor
            Found in src/Angular.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 copyType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function copyType(source) {
                switch (toString.call(source)) {
                  case '[object Int8Array]':
                  case '[object Int16Array]':
                  case '[object Int32Array]':
            Severity: Minor
            Found in src/Angular.js - About 1 hr to fix

              Function allowAutoBootstrap has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function allowAutoBootstrap(document) {
                var script = document.currentScript;
              
                if (!script) {
                  // Support: IE 9-11 only
              Severity: Minor
              Found in src/Angular.js - About 1 hr to fix

                Function bindJQuery has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function bindJQuery() {
                  var originalCleanData;
                
                  if (bindJQueryFired) {
                    return;
                Severity: Minor
                Found in src/Angular.js - About 1 hr to fix

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

                  function baseExtend(dst, objs, deep) {
                    var h = dst.$$hashKey;
                  
                    for (var i = 0, ii = objs.length; i < ii; ++i) {
                      var obj = objs[i];
                  Severity: Minor
                  Found in src/Angular.js - About 1 hr to fix

                    Function copyRecurse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function copyRecurse(source, destination, maxDepth) {
                        maxDepth--;
                        if (maxDepth < 0) {
                          return '...';
                        }
                    Severity: Minor
                    Found in src/Angular.js - About 1 hr to fix

                      Function doBootstrap has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        var doBootstrap = function() {
                          element = jqLite(element);
                      
                          if (element.injector()) {
                            var tag = (element[0] === window.document) ? 'document' : startingTag(element);
                      Severity: Minor
                      Found in src/Angular.js - About 1 hr to fix

                        Function angularInit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function angularInit(element, bootstrap) {
                          var appElement,
                              module,
                              config = {};
                        
                        
                        Severity: Minor
                        Found in src/Angular.js - About 1 hr to fix

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

                          var csp = function() {
                            if (!isDefined(csp.rules)) {
                          
                          
                              var ngCspElement = (window.document.querySelector('[ng-csp]') ||
                          Severity: Minor
                          Found in src/Angular.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                  if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
                                    isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
                            Severity: Major
                            Found in src/Angular.js - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                    for (key in o2) {
                                      if (!(key in keySet) &&
                                          key.charAt(0) !== '$' &&
                                          isDefined(o2[key]) &&
                                          !isFunction(o2[key])) return false;
                              Severity: Major
                              Found in src/Angular.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                        if (isPrimitive || key in obj) {
                                          iterator.call(context, obj[key], key, obj);
                                        }
                                Severity: Major
                                Found in src/Angular.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                          if (source.hasOwnProperty(key)) {
                                            destination[key] = copyElement(source[key], maxDepth);
                                          }
                                  Severity: Major
                                  Found in src/Angular.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                        } else if (typeof obj.hasOwnProperty === 'function') {
                                          // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
                                          for (key in obj) {
                                            if (obj.hasOwnProperty(key)) {
                                              iterator.call(context, obj[key], key, obj);
                                    Severity: Major
                                    Found in src/Angular.js - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                            for (key in obj) {
                                              iterator.call(context, obj[key], key, obj);
                                            }
                                      Severity: Major
                                      Found in src/Angular.js - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                if (hasOwnProperty.call(source, key)) {
                                                  destination[key] = copyElement(source[key], maxDepth);
                                                }
                                        Severity: Major
                                        Found in src/Angular.js - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                    if (!equals(o1[key], o2[key])) return false;
                                          Severity: Major
                                          Found in src/Angular.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                  if (!isRegExp(o2)) return false;
                                            Severity: Major
                                            Found in src/Angular.js - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                    for (key in o1) {
                                                      if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
                                                      if (!equals(o1[key], o2[key])) return false;
                                                      keySet[key] = true;
                                                    }
                                              Severity: Major
                                              Found in src/Angular.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                          if (key !== '__proto__') {
                                                            if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
                                                            baseExtend(dst[key], [src], true);
                                                          }
                                                Severity: Major
                                                Found in src/Angular.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                        if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
                                                          isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
                                                  Severity: Major
                                                  Found in src/Angular.js - About 45 mins to fix

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

                                                    function getBlockNodes(nodes) {
                                                      // TODO(perf): update `nodes` instead of creating a new object?
                                                      var node = nodes[0];
                                                      var endNode = nodes[nodes.length - 1];
                                                      var blockNodes;
                                                    Severity: Minor
                                                    Found in src/Angular.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 csp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                    var csp = function() {
                                                      if (!isDefined(csp.rules)) {
                                                    
                                                    
                                                        var ngCspElement = (window.document.querySelector('[ng-csp]') ||
                                                    Severity: Minor
                                                    Found in src/Angular.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

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            if (!equals(o1[key], o2[key])) return false;
                                                    Severity: Major
                                                    Found in src/Angular.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                            return simpleCompare(o1.getTime(), o2.getTime());
                                                      Severity: Major
                                                      Found in src/Angular.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                              if (!isRegExp(o2)) return false;
                                                        Severity: Major
                                                        Found in src/Angular.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                            return false;
                                                          Severity: Major
                                                          Found in src/Angular.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                      if (!equals(o1[key], o2[key])) return false;
                                                            Severity: Major
                                                            Found in src/Angular.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                    if (!isDate(o2)) return false;
                                                              Severity: Major
                                                              Found in src/Angular.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                            !isFunction(o2[key])) return false;
                                                                Severity: Major
                                                                Found in src/Angular.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return true;
                                                                  Severity: Major
                                                                  Found in src/Angular.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                          return true;
                                                                    Severity: Major
                                                                    Found in src/Angular.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                            return o1.toString() === o2.toString();
                                                                      Severity: Major
                                                                      Found in src/Angular.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
                                                                        Severity: Major
                                                                        Found in src/Angular.js - About 30 mins to fix

                                                                          Function stringify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          function stringify(value) {
                                                                            if (value == null) { // null || undefined
                                                                              return '';
                                                                            }
                                                                            switch (typeof value) {
                                                                          Severity: Minor
                                                                          Found in src/Angular.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

                                                                          Function bind has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          function bind(self, fn) {
                                                                            var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
                                                                            if (isFunction(fn) && !(fn instanceof RegExp)) {
                                                                              return curryArgs.length
                                                                                ? function() {
                                                                          Severity: Minor
                                                                          Found in src/Angular.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

                                                                          Function getter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          function getter(obj, path, bindFnToScope) {
                                                                            if (!path) return obj;
                                                                            var keys = path.split('.');
                                                                            var key;
                                                                            var lastInstance = obj;
                                                                          Severity: Minor
                                                                          Found in src/Angular.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

                                                                          There are no issues that match your filters.

                                                                          Category
                                                                          Status