angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

Function ngViewFactory has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ngViewFactory($route, $anchorScroll, $animate) {
  return {
    restrict: 'ECA',
    terminal: true,
    priority: 400,
Severity: Major
Found in src/ngRoute/directive/ngView.js - About 2 hrs to fix

    prototype has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    NgModelController.prototype = {
      $$initGetterSetters: function() {
        if (this.$options.getOption('getterSetter')) {
          var invokeModelGetter = this.$$parse(this.$$attr.ngModel + '()'),
              invokeModelSetter = this.$$parse(this.$$attr.ngModel + '($$$p)');
    Severity: Minor
    Found in src/ng/directive/ngModel.js - About 2 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 bind has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            bind: function(element, eventHandlers, pointerTypes) {
              // Absolute total movement, used to control swipe vs. scroll.
              var totalX, totalY;
              // Coordinates of the start position.
              var startCoords;
        Severity: Major
        Found in src/ngTouch/swipe.js - About 2 hrs to fix

          Function $SceProvider has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function $SceProvider() {
            var enabled = true;
          
            /**
             * @ngdoc method
          Severity: Major
          Found in src/ng/sce.js - About 2 hrs to fix

            Function areAnimationsAllowed has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function areAnimationsAllowed(node, parentNode, event) {
                  var bodyNode = $document[0].body;
                  var rootNode = getDomNode($rootElement);
            
                  var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML';
            Severity: Major
            Found in src/ngAnimate/animateQueue.js - About 2 hrs to fix

              Function $process has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  $process: function(docs) {
              
                    // We are only interested in docs that are in an area
                    var pages = _.filter(docs, function(doc) {
                      return doc.area;
              Severity: Major
              Found in docs/config/processors/pages-data.js - About 2 hrs to fix

                Function $TimeoutProvider has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function $TimeoutProvider() {
                  this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
                       function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {
                
                    var deferreds = {};
                Severity: Minor
                Found in src/ng/timeout.js - About 2 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 roundNumber has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
                    var digits = parsedNumber.d;
                    var fractionLen = digits.length - parsedNumber.i;
                
                    // determine fractionSize if it is not specified; `+fractionSize` converts it to a number
                Severity: Minor
                Found in src/ng/filter/filters.js - About 2 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 $SnifferProvider has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                function $SnifferProvider() {
                  this.$get = ['$window', '$document', function($window, $document) {
                    var eventSupport = {},
                        // Chrome Packaged Apps are not allowed to access `history.pushState`.
                        // If not sandboxed, they can be detected by the presence of `chrome.app.runtime`
                Severity: Minor
                Found in src/ng/sniffer.js - About 2 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 $RootScopeDecorator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
                
                  var $rootScopePrototype = Object.getPrototypeOf($delegate);
                
                  $rootScopePrototype.$countChildScopes = countChildScopes;
                Severity: Minor
                Found in src/ngMock/angular-mocks.js - About 2 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 attr has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  attr: function(element, name, value) {
                    var ret;
                    var nodeType = element.nodeType;
                    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT ||
                      !element.getAttribute) {
                Severity: Minor
                Found in src/jqLite.js - About 2 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 compile has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  compile: function(ast) {
                    var self = this;
                    this.state = {
                      nextId: 0,
                      filters: {},
                Severity: Major
                Found in src/ng/parse.js - About 2 hrs to fix

                  Function $watchGroup has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        $watchGroup: function(watchExpressions, listener) {
                          var oldValues = new Array(watchExpressions.length);
                          var newValues = new Array(watchExpressions.length);
                          var deregisterFns = [];
                          var self = this;
                  Severity: Major
                  Found in src/ng/rootScope.js - About 2 hrs to fix

                    Function link has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          link: function(scope, element, attrs, ngMessagesCtrl, $transclude) {
                            var commentNode, records, staticExp, dynamicExp;
                    
                            if (!isDefault) {
                              commentNode = element[0];
                    Severity: Major
                    Found in src/ngMessages/messages.js - About 2 hrs to fix

                      Function $LogProvider has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      angular.mock.$LogProvider = function() {
                        var debug = true;
                      
                        function concat(array1, array2, index) {
                          return array1.concat(Array.prototype.slice.call(array2, index));
                      Severity: Major
                      Found in src/ngMock/angular-mocks.js - About 2 hrs to fix

                        Function ngPluralizeDirective has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
                          var BRACE = /{}/g,
                              IS_WHEN = /^when(Minus)?(.+)$/;
                        
                          return {
                        Severity: Minor
                        Found in src/ng/directive/ngPluralize.js - About 2 hrs to fix

                          Function $set has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                $set: function(key, value, writeAttr, attrName) {
                                  // TODO: decide whether or not to throw an error if "class"
                                  // is set through this function since it may cause $updateClass to
                                  // become unstable.
                          
                          
                          Severity: Minor
                          Found in src/ng/compile.js - About 2 hrs to fix

                            Function $LogProvider has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function $LogProvider() {
                              var debug = true,
                                  self = this;
                            
                              /**
                            Severity: Minor
                            Found in src/ng/log.js - About 2 hrs to fix

                              Consider simplifying this complex logical expression.
                              Open

                                "pluralCat": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {    return PLURAL_CATEGORY.FEW;  }  if (vf.v == 0 && i != 1 && i % 10 >= 0 && i % 10 <= 1 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 12 && i % 100 <= 14) {    return PLURAL_CATEGORY.MANY;  }  return PLURAL_CATEGORY.OTHER;}
                              Severity: Critical
                              Found in src/ngLocale/angular-locale_pl.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language