angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

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 $get has 94 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.$get = function() {
        var caches = {};
    
        function cacheFactory(cacheId, options) {
          if (cacheId in caches) {
    Severity: Major
    Found in src/ng/cacheFactory.js - About 3 hrs to fix

      Function TzDate has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      angular.mock.TzDate = function(offset, timestamp) {
        var self = new Date(0);
        if (angular.isString(timestamp)) {
          var tsStr = timestamp;
      
      
      Severity: Major
      Found in src/ngMock/angular-mocks.js - About 3 hrs to fix

        Function ngTranscludeDirective has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        var ngTranscludeDirective = ['$compile', function($compile) {
          return {
            restrict: 'EAC',
            compile: function ngTranscludeCompile(tElement) {
        
        
        Severity: Minor
        Found in src/ng/directive/ngTransclude.js - About 3 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 TaskTracker has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        function TaskTracker(log) {
          var self = this;
          var taskCounts = {};
          var taskCallbacks = [];
        
        
        Severity: Minor
        Found in src/ng/taskTrackerFactory.js - About 3 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 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 $interpolate has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
                var contextAllowsConcatenation = trustedContext === $sce.URL || trustedContext === $sce.MEDIA_URL;
          
                // Provide a quick exit and simplified result function for text with no interpolation
                if (!text.length || text.indexOf(startSymbol) === -1) {
          Severity: Major
          Found in src/ng/interpolate.js - About 3 hrs to fix

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

                function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {
                  var clone = jqLite(getDomNode(outAnchor).cloneNode(true));
                  var startingClasses = filterCssClasses(getClassVal(clone));
            
                  outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
            Severity: Major
            Found in src/ngAnimate/animateCssDriver.js - About 3 hrs to fix

              Function createDateInputType has 91 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createDateInputType(type, regexp, parseDate, format) {
                return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
                  badInputChecker(scope, element, attr, ctrl, type);
                  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
              
              
              Severity: Major
              Found in src/ng/directive/input.js - About 3 hrs to fix

                File sanitize.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                 *     Any commits to this file should be reviewed with security in mind.  *
                 *   Changes to this file can potentially create security vulnerabilities. *
                Severity: Minor
                Found in src/ngSanitize/sanitize.js - About 3 hrs to fix

                  Function $Browser has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  angular.mock.$Browser = function($log, $$taskTrackerFactory) {
                    var self = this;
                    var taskTracker = $$taskTrackerFactory($log);
                  
                    this.isMock = true;
                  Severity: Major
                  Found in src/ngMock/angular-mocks.js - About 3 hrs to fix

                    Function baseInputType has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
                      var type = lowercase(element[0].type);
                    
                      // In composition mode, users are still inputting intermediate text buffer,
                      // hold the listener until composition is done.
                    Severity: Minor
                    Found in src/ng/directive/input.js - About 3 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 lex has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                      lex: function(text) {
                        this.text = text;
                        this.index = 0;
                        this.tokens = [];
                    
                    
                    Severity: Minor
                    Found in src/ng/parse.js - About 3 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 formDirectiveFactory has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var formDirectiveFactory = function(isNgForm) {
                      return ['$timeout', '$parse', function($timeout, $parse) {
                        var formDirective = {
                          name: 'form',
                          restrict: isNgForm ? 'EAC' : 'E',
                    Severity: Minor
                    Found in src/ng/directive/form.js - About 3 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 dynamicDateInputType has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
                        badInputChecker(scope, element, attr, ctrl, type);
                        baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
                    
                        var isTimeType = type === 'time' || type === 'datetimelocal';
                    Severity: Major
                    Found in src/ng/directive/input.js - About 3 hrs to fix

                      Function $digest has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            $digest: function() {
                              var watch, value, last, fn, get,
                                  watchers,
                                  dirty, ttl = TTL,
                                  next, current, target = asyncQueue.length ? $rootScope : this,
                      Severity: Major
                      Found in src/ng/rootScope.js - About 3 hrs to fix

                        Function MockHttpExpectation has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function MockHttpExpectation(expectedMethod, expectedUrl, expectedData, expectedHeaders,
                                                     expectedKeys) {
                        
                          this.data = expectedData;
                          this.headers = expectedHeaders;
                        Severity: Major
                        Found in src/ngMock/angular-mocks.js - About 3 hrs to fix

                          Function triggerAnimationStart has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function triggerAnimationStart() {
                                    // just incase a stagger animation kicks in when the animation
                                    // itself was cancelled entirely
                                    if (animationClosed) return;
                          
                          
                          Severity: Major
                          Found in src/ngAnimate/animateCss.js - About 3 hrs to fix

                            Function ngViewFactory has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function ngViewFactory($route, $anchorScroll, $animate) {
                              return {
                                restrict: 'ECA',
                                terminal: true,
                                priority: 400,
                            Severity: Minor
                            Found in src/ngRoute/directive/ngView.js - About 3 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 $$CoreAnimateQueueProvider has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var $$CoreAnimateQueueProvider = /** @this */ function() {
                              var postDigestQueue = new NgMap();
                              var postDigestElements = [];
                            
                              this.$get = ['$$AnimateRunner', '$rootScope',
                            Severity: Major
                            Found in src/ng/animate.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language