angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

Function dump has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

angular.mock.dump = function(object) {
  return serialize(object);

  function serialize(object) {
    var out;
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

File q.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
 * @ngdoc service
 * @name $q
Severity: Minor
Found in src/ng/q.js - About 2 hrs to fix

    Function selectDirective has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var selectDirective = function() {
    
      return {
        restrict: 'E',
        require: ['select', '?ngModel'],
    Severity: Major
    Found in src/ng/directive/select.js - About 2 hrs to fix

      Function $get has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.$get = ['$$animateQueue', function($$animateQueue) {
          function domInsert(element, parentElement, afterElement) {
            // if for some reason the previous element was removed
            // from the dom sometime before this code runs then let's
            // just stick to using the parent element as the anchor
      Severity: Major
      Found in src/ng/animate.js - About 2 hrs to fix

        Function groupAnimations has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              function groupAnimations(animations) {
                var preparedAnimations = [];
                var refLookup = {};
                forEach(animations, function(animation, index) {
                  var element = animation.element;
        Severity: Major
        Found in src/ngAnimate/animation.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 (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}
          Severity: Critical
          Found in src/ngLocale/angular-locale_tl.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 (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}
            Severity: Critical
            Found in src/ngLocale/angular-locale_fil-ph.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 (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}
              Severity: Critical
              Found in src/ngLocale/angular-locale_fil.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                  if (vf.v == 0 && (i == 1 || i == 2 || i == 3) || vf.v == 0 && i % 10 != 4 && i % 10 != 6 && i % 10 != 9 || vf.v != 0 && vf.f % 10 != 4 && vf.f % 10 != 6 && vf.f % 10 != 9) {
                    return goog.i18n.pluralRules.Keyword.ONE;
                  }
                Severity: Critical
                Found in i18n/closure/pluralRules.js - About 2 hrs to fix

                  Function getDirectoryListing has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function getDirectoryListing(path) {
                      if (!path.endsWith('/')) path += '/';
                  
                      const getFilesOptions = {
                        delimiter: '/',
                  Severity: Major
                  Found in scripts/code.angularjs.org-firebase/functions/index.js - About 2 hrs to fix

                    Function sortAnimations has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function sortAnimations(animations) {
                          var tree = { children: [] };
                          var i, lookup = new $$Map();
                    
                          // this is done first beforehand so that the map
                    Severity: Major
                    Found in src/ngAnimate/animation.js - About 2 hrs to fix

                      Function LocationHtml5Url has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
                        this.$$html5 = true;
                        basePrefix = basePrefix || '';
                        parseAbsoluteUrl(appBase, this);
                      
                      
                      Severity: Minor
                      Found in src/ng/location.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 $$CookieWriter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function $$CookieWriter($document, $log, $browser) {
                        var cookiePath = $browser.baseHref();
                        var rawDocument = $document[0];
                      
                        function buildCookieString(name, value, options) {
                      Severity: Minor
                      Found in src/ngCookies/cookieWriter.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 $AnchorScrollProvider has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function $AnchorScrollProvider() {
                      
                        var autoScrollingEnabled = true;
                      
                        /**
                      Severity: Major
                      Found in src/ng/anchorScroll.js - About 2 hrs to fix

                        Function $watchCollectionInterceptor has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function $watchCollectionInterceptor(_value) {
                                  newValue = _value;
                                  var newLength, key, bothNaN, newItem, oldItem;
                        
                                  // If the new value is undefined, then return undefined as the watch may be a one-time watch
                        Severity: Major
                        Found in src/ng/rootScope.js - About 2 hrs to fix

                          File messages.js has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          'use strict';
                          
                          var forEach;
                          var isArray;
                          var isString;
                          Severity: Minor
                          Found in src/ngMessages/messages.js - About 2 hrs to fix

                            Function TaskTracker has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function TaskTracker(log) {
                              var self = this;
                              var taskCounts = {};
                              var taskCallbacks = [];
                            
                            
                            Severity: Major
                            Found in src/ng/taskTrackerFactory.js - About 2 hrs to fix

                              File injector.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              'use strict';
                              
                              /**
                               * @ngdoc function
                               * @module ng
                              Severity: Minor
                              Found in src/auto/injector.js - About 2 hrs to fix

                                Function compile has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    compile: function(element, attr) {
                                      var srcExp = attr.ngInclude || attr.src,
                                          onloadExp = attr.onload || '',
                                          autoScrollExp = attr.autoscroll;
                                
                                
                                Severity: Major
                                Found in src/ng/directive/ngInclude.js - About 2 hrs to fix

                                  Function ruleInAngularExpression has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() {
                                    var match = this.searchRe(INTERESTING_OPERATORS_RE);
                                    var position;
                                    if (match == null) {
                                      if (this.angularOperatorStack.length === 0) {
                                  Severity: Major
                                  Found in src/ngMessageFormat/messageFormatParser.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language