angular/angular.js

View on GitHub

Showing 2,008 of 4,250 total issues

Function ngFormCompile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      compile: function ngFormCompile(formElement, attr) {
        // Setup initial state of the control
        formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);

        var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
Severity: Minor
Found in src/ng/directive/form.js - About 1 hr to fix

    Function ngTranscludeCompile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        compile: function ngTranscludeCompile(tElement) {
    
          // Remove and cache any original content to act as a fallback
          var fallbackLinkFn = $compile(tElement.contents());
          tElement.empty();
    Severity: Minor
    Found in src/ng/directive/ngTransclude.js - About 1 hr to fix

      Function addAttrInterpolateDirective has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function addAttrInterpolateDirective(node, directives, value, name, isNgAttr) {
            var nodeName = nodeName_(node);
            var trustedContext = getTrustedAttrContext(nodeName, name);
            var mustHaveExpression = !isNgAttr;
            var allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr;
      Severity: Minor
      Found in src/ng/compile.js - About 1 hr to fix

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

            $process: function(docs) {
        
              // Get the extracted min errors to compare with the error docs, and report any mismatch
              var collectedErrors = require('../../../build/errors.json').errors;
              var flatErrors = [];
        Severity: Minor
        Found in docs/config/processors/error-docs.js - About 1 hr to fix

          Function packageAnimations has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function packageAnimations(element, event, options, animations, fnName) {
                  var operations = groupEventedAnimations(element, event, options, animations, fnName);
                  if (operations.length === 0) {
                    var a, b;
                    if (fnName === 'beforeSetClass') {
          Severity: Minor
          Found in src/ngAnimate/animateJs.js - About 1 hr to fix

            Function makeSwipeDirective has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function makeSwipeDirective(directiveName, direction, eventName) {
              ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
                // The maximum vertical delta for a swipe should be less than 75px.
                var MAX_VERTICAL_DISTANCE = 75;
                // Vertical distance should not be more than a fraction of the horizontal distance.
            Severity: Minor
            Found in src/ngTouch/directive/ngSwipe.js - About 1 hr to fix

              Function extractValues has 40 lines of code (exceeds 25 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 1 hr to fix

                Function navGroups has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        .map(function(modulePages, moduleName) {
                          log.debug('moduleName: ' + moduleName);
                          var navItems = [];
                          var modulePage;
                
                
                Severity: Minor
                Found in docs/config/processors/pages-data.js - About 1 hr to fix

                  Function sendStoredFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function sendStoredFile(request, response) {
                    // Request paths will be URI-encoded, so we need to decode them to match the file names in the
                    // storage bucket. Failing to do so will result in a 404 error from the bucket and `index.html`
                    // will be returned instead.
                    // Example of path requiring decoding: `.../input%5Btext%5D.html` --> `.../input[text].html`
                  Severity: Minor
                  Found in scripts/code.angularjs.org-firebase/functions/index.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 parse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function parse(numStr) {
                    var exponent = 0, digits, numberOfIntegerDigits;
                    var i, j, zeros;
                  
                    // Decimal point?
                  Severity: Minor
                  Found in src/ng/filter/filters.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 jqLiteOn has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    on: function jqLiteOn(element, type, fn, unsupported) {
                      if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
                  
                      // Do not add event handlers to non-elements because they will not be cleaned up.
                      if (!jqLiteAcceptsData(element)) {
                  Severity: Minor
                  Found in src/jqLite.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 jqLiteBuildFragment has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function jqLiteBuildFragment(html, context) {
                    var tmp, tag, wrap, finalHtml,
                        fragment = context.createDocumentFragment(),
                        nodes = [], i;
                  
                  
                  Severity: Minor
                  Found in src/jqLite.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 brSelect_ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  goog.i18n.pluralRules.brSelect_ = function(n, opt_precision) {
                    if (n % 10 == 1 && n % 100 != 11 && n % 100 != 71 && n % 100 != 91) {
                      return goog.i18n.pluralRules.Keyword.ONE;
                    }
                    if (n % 10 == 2 && n % 100 != 12 && n % 100 != 72 && n % 100 != 92) {
                  Severity: Minor
                  Found in i18n/closure/pluralRules.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 $setValidity has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    clazz.prototype.$setValidity = function(validationErrorKey, state, controller) {
                      if (isUndefined(state)) {
                        createAndSet(this, '$pending', validationErrorKey, controller);
                      } else {
                        unsetAndCleanup(this, '$pending', validationErrorKey, controller);
                  Severity: Minor
                  Found in src/ng/directive/form.js - About 1 hr to fix

                    Function url has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      self.url = function(url, replace, state) {
                        // In modern browsers `history.state` is `null` by default; treating it separately
                        // from `undefined` would cause `$browser.url('/foo')` to change `history.state`
                        // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.
                        if (isUndefined(state)) {
                    Severity: Minor
                    Found in src/ng/browser.js - About 1 hr to fix

                      Function publicLinkFn has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            return function publicLinkFn(scope, cloneConnectFn, options) {
                              if (!$compileNodes) {
                                throw $compileMinErr('multilink', 'This element has already been linked.');
                              }
                              assertArg(scope, 'scope');
                      Severity: Minor
                      Found in src/ng/compile.js - About 1 hr to fix

                        Function registerComponent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          this.component = function registerComponent(name, options) {
                            if (!isString(name)) {
                              forEach(name, reverseParams(bind(this, registerComponent)));
                              return this;
                            }
                        Severity: Minor
                        Found in src/ng/compile.js - About 1 hr to fix

                          Function roundNumber has 39 lines of code (exceeds 25 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 1 hr to fix

                            Function $broadcast has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  $broadcast: function(name, args) {
                                    var target = this,
                                        current = target,
                                        next = target,
                                        event = {
                            Severity: Minor
                            Found in src/ng/rootScope.js - About 1 hr to fix

                              Function prepareFromToAnchorAnimation has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function prepareFromToAnchorAnimation(from, to, classes, anchors) {
                                    var fromAnimation = prepareRegularAnimation(from, noop);
                                    var toAnimation = prepareRegularAnimation(to, noop);
                              
                                    var anchorAnimations = [];
                              Severity: Minor
                              Found in src/ngAnimate/animateCssDriver.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language