angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

Function selectDirective has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

var selectDirective = function() {

  return {
    restrict: 'E',
    require: ['select', '?ngModel'],
Severity: Minor
Found in src/ng/directive/select.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 $Browser has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

angular.mock.$Browser = function($log, $$taskTrackerFactory) {
  var self = this;
  var taskTracker = $$taskTrackerFactory($log);

  this.isMock = true;
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 jqLiteAddNodes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function jqLiteAddNodes(root, elements) {
  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.

  if (elements) {

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 jqLiteOff has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function jqLiteOff(element, type, fn, unsupported) {
  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');

  var expandoStore = jqLiteExpandoStore(element);
  var events = expandoStore && expandoStore.events;
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 jqLiteData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function jqLiteData(element, key, value) {
  if (jqLiteAcceptsData(element)) {
    var prop;

    var isSimpleSetter = isDefined(value);
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 extractValues has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function extractValues(stream, propertiesToExtract, callback) {
  var saxStream = sax.createStream(saxStrict, saxOptions);
  var firstValid = {};
  var lastValid = {};
  var keys = Object.keys(propertiesToExtract);
Severity: Minor
Found in i18n/ucd/src/extractValues.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 link has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      link: function(scope, element, attr) {
        var classCounts = element.data('$classCounts');
        var oldModulo = true;
        var oldClassString;

Severity: Major
Found in src/ng/directive/ngClass.js - About 2 hrs to fix

    Function dateFilter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function dateFilter($locale) {
    
    
      var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
                         // 1        2       3         4          5          6          7          8  9     10      11
    Severity: Major
    Found in src/ng/filter/filters.js - About 2 hrs to fix

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

          $process: function(docs) {
      
            // Keywords to ignore
            var wordsToIgnore = [];
            var propertiesToIgnore;
      Severity: Major
      Found in docs/config/processors/keywords.js - About 2 hrs to fix

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

          this.$get = ['$injector', function($injector) {
        
            /**
             * @ngdoc service
             * @name $controller
        Severity: Major
        Found in src/ng/controller.js - About 2 hrs to fix

          Function $IntervalProvider has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          angular.mock.$IntervalProvider = function() {
            this.$get = ['$browser', '$$intervalFactory',
                 function($browser,   $$intervalFactory) {
              var repeatFns = [],
                  nextRepeatId = 0,
          Severity: Major
          Found in src/ngMock/angular-mocks.js - About 2 hrs to fix

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

              this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
                var document = $window.document;
            
                // Helper function to get first anchor from a NodeList
                // (using `Array#some()` instead of `angular#forEach()` since it's more performant
            Severity: Major
            Found in src/ng/anchorScroll.js - About 2 hrs to fix

              Function formDirectiveFactory has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var formDirectiveFactory = function(isNgForm) {
                return ['$timeout', '$parse', function($timeout, $parse) {
                  var formDirective = {
                    name: 'form',
                    restrict: isNgForm ? 'EAC' : 'E',
              Severity: Major
              Found in src/ng/directive/form.js - About 2 hrs to fix

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

                  $$runValidators: function(modelValue, viewValue, doneCallback) {
                    this.$$currentValidationRunId++;
                    var localValidationRunId = this.$$currentValidationRunId;
                    var that = this;
                
                
                Severity: Minor
                Found in src/ng/directive/ngModel.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 object has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                  object: function() {
                    var properties = [], property;
                    if (this.peekToken().text !== '}') {
                      do {
                        if (this.peek('}')) {
                Severity: Minor
                Found in src/ng/parse.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 defaultHttpResponseTransform has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                function defaultHttpResponseTransform(data, headers) {
                  if (isString(data)) {
                    // Strip json vulnerability protection prefix and trim whitespace
                    var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
                
                
                Severity: Minor
                Found in src/ng/http.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 $$AnimateCacheProvider has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                var $$AnimateCacheProvider = function() {
                
                  var KEY = '$$ngAnimateParentKey';
                  var parentCounter = 0;
                  var cache = Object.create(null);
                Severity: Minor
                Found in src/ngAnimate/animateCache.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 annotate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                function annotate(fn, strictDi, name) {
                  var $inject,
                      argDecl,
                      last;
                
                
                Severity: Minor
                Found in src/auto/injector.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 $get has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                       function($browser,   $$intervalFactory) {
                    var repeatFns = [],
                        nextRepeatId = 0,
                        now = 0,
                        setIntervalFn = function(tick, delay, deferred, skipApply) {
                Severity: Major
                Found in src/ngMock/angular-mocks.js - About 2 hrs to fix

                  Function setUrlParams has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          setUrlParams: function(config, params, actionUrl) {
                            var self = this,
                              url = actionUrl || self.template,
                              val,
                              encodedVal,
                  Severity: Major
                  Found in src/ngResource/resource.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language