angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

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

    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-pl.js - About 2 hrs to fix

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

              this.render = function(collection) {
                collection = collection || {};
      
                renderLater = false;
                cachedCollection = collection;
      Severity: Minor
      Found in src/ngMessages/messages.js - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

          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 goog.i18n.pluralRules.Keyword.MANY;
          }
        Severity: Critical
        Found in i18n/closure/pluralRules.js - About 2 hrs to fix

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

              function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
                                  previousCompileContext) {
                if (!($compileNodes instanceof jqLite)) {
                  // jquery always rewraps, whereas we need to preserve the original selector so that we can
                  // modify it.
          Severity: Minor
          Found in src/ng/compile.js - About 1 hr to fix

            Function $controller has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                return function $controller(expression, locals, later, ident) {
                  // PRIVATE API:
                  //   param `later` --- indicates that the controller's constructor is invoked at a later time.
                  //                     If true, $controller will allocate the object with the correct
                  //                     prototype chain, but will not invoke the controller until a returned
            Severity: Minor
            Found in src/ng/controller.js - About 1 hr to fix

              Function formatNumber has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
              
                if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
              
                var isInfinity = !isFinite(number);
              Severity: Minor
              Found in src/ng/filter/filters.js - About 1 hr to fix

                Function htmlParserImpl has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function htmlParserImpl(html, handler) {
                    if (html === null || html === undefined) {
                      html = '';
                    } else if (typeof html !== 'string') {
                      html = '' + html;
                Severity: Minor
                Found in src/ngSanitize/sanitize.js - About 1 hr to fix

                  Function ngSwitchDirective has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {
                    return {
                      require: 'ngSwitch',
                  
                      // asks for $scope to fool the BC controller module
                  Severity: Minor
                  Found in src/ng/directive/ngSwitch.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 $TemplateRequestProvider has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function $TemplateRequestProvider() {
                  
                    var httpOptions;
                  
                    /**
                  Severity: Minor
                  Found in src/ng/templateRequest.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 getCdnVersion has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var getCdnVersion = function() {
                    return _(previousVersions)
                      .filter(function(tag) {
                        return semver.satisfies(tag, currentPackage.branchVersion);
                      })
                  Severity: Minor
                  Found in lib/versions/version-info.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 numberInputType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function numberInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
                    badInputChecker(scope, element, attr, ctrl, 'number');
                    numberFormatterParser(ctrl);
                    baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
                  
                  
                  Severity: Minor
                  Found in src/ng/directive/input.js - About 1 hr to fix

                    Function selectPreLink has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function selectPreLink(scope, element, attr, ctrls) {
                    
                          var selectCtrl = ctrls[0];
                          var ngModelCtrl = ctrls[1];
                    
                    
                    Severity: Minor
                    Found in src/ng/directive/select.js - About 1 hr to fix

                      Function $TemplateRequestProvider has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function $TemplateRequestProvider() {
                      
                        var httpOptions;
                      
                        /**
                      Severity: Minor
                      Found in src/ng/templateRequest.js - About 1 hr to fix

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

                               function($rootScope,   $browser,   $location) {
                        
                            /**
                             * @name $testability
                             *
                        Severity: Minor
                        Found in src/ng/testability.js - About 1 hr to fix

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

                              link: function(scope, $element, attr, ctrl, $transclude) {
                                  var currentScope,
                                      currentElement,
                                      previousLeaveAnimation,
                                      autoScrollExp = attr.autoscroll,
                          Severity: Minor
                          Found in src/ngRoute/directive/ngView.js - About 1 hr to fix

                            Function api has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                api: function(areaPages, area) {
                                  var navGroups = _(areaPages)
                                    .filter('module') // We are not interested in docs that are not in a module
                            
                                    .groupBy('module')
                            Severity: Minor
                            Found in docs/config/processors/pages-data.js - About 1 hr to fix

                              Function MockXhr has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function MockXhr() {
                              
                                // hack for testing $http, $httpBackend
                                MockXhr.$$lastInstance = this;
                              
                              
                              Severity: Minor
                              Found in src/ngMock/angular-mocks.js - About 1 hr to fix

                                Function $$AnimateJsDriverProvider has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                var $$AnimateJsDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) {
                                  $$animationProvider.drivers.push('$$animateJsDriver');
                                  this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {
                                    return function initDriverFn(animationDetails) {
                                      if (animationDetails.from && animationDetails.to) {
                                Severity: Minor
                                Found in src/ngAnimate/animateJsDriver.js - About 1 hr to fix

                                  Function errorDocsProcessor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  module.exports = function errorDocsProcessor(log, errorNamespaceMap, getMinerrInfo) {
                                    return {
                                      $runAfter: ['tags-extracted'],
                                      $runBefore: ['extra-docs-added'],
                                      $process: function(docs) {
                                  Severity: Minor
                                  Found in docs/config/processors/error-docs.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language