angular/angular.js

View on GitHub
src/ng/animate.js

Summary

Maintainability
F
4 days
Test Coverage

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

var $AnimateProvider = ['$provide', /** @this */ function($provide) {
  var provider = this;
  var classNameFilter = null;
  var customFilter = null;

Severity: Minor
Found in src/ng/animate.js - About 6 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 a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

var $$CoreAnimateQueueProvider = /** @this */ function() {
  var postDigestQueue = new NgMap();
  var postDigestElements = [];

  this.$get = ['$$AnimateRunner', '$rootScope',
Severity: Minor
Found in src/ng/animate.js - About 4 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 $AnimateProvider has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var $AnimateProvider = ['$provide', /** @this */ function($provide) {
  var provider = this;
  var classNameFilter = null;
  var customFilter = null;

Severity: Major
Found in src/ng/animate.js - About 4 hrs to fix

    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

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

             function($$AnimateRunner,   $rootScope) {
          return {
            enabled: noop,
            on: noop,
            off: noop,
      Severity: Major
      Found in src/ng/animate.js - About 3 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 handleCSSClassChanges has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function handleCSSClassChanges() {
                forEach(postDigestElements, function(element) {
                  var data = postDigestQueue.get(element);
                  if (data) {
                    var existing = splitClasses(element.attr('class'));
          Severity: Minor
          Found in src/ng/animate.js - About 1 hr to fix

            Function animate has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  animate: function(element, from, to, className, options) {
            Severity: Minor
            Found in src/ng/animate.js - About 35 mins to fix

              Function mergeClasses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function mergeClasses(a,b) {
                if (!a && !b) return '';
                if (!a) return b;
                if (!b) return a;
                if (isArray(a)) a = a.join(' ');
              Severity: Minor
              Found in src/ng/animate.js - About 25 mins 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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

              function mergeClasses(a,b) {
                if (!a && !b) return '';
                if (!a) return b;
                if (!b) return a;
                if (isArray(a)) a = a.join(' ');
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 3 hrs to fix
              src/ngAnimate/shared.js on lines 66..73

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 100.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    enter: function(element, parent, after, options) {
                      parent = parent && jqLite(parent);
                      after = after && jqLite(after);
                      parent = parent || after.parent();
                      domInsert(element, parent, after);
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 2 hrs to fix
              src/ng/animate.js on lines 622..628

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 90.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    move: function(element, parent, after, options) {
                      parent = parent && jqLite(parent);
                      after = after && jqLite(after);
                      parent = parent || after.parent();
                      domInsert(element, parent, after);
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 2 hrs to fix
              src/ng/animate.js on lines 590..596

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 90.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    removeClass: function(element, className, options) {
                      options = prepareAnimateOptions(options);
                      options.removeClass = mergeClasses(options.removeClass, className);
                      return $$animateQueue.push(element, 'removeClass', options);
                    },
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 1 hr to fix
              src/ng/animate.js on lines 678..682

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 59.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    addClass: function(element, className, options) {
                      options = prepareAnimateOptions(options);
                      options.addClass = mergeClasses(options.addclass, className);
                      return $$animateQueue.push(element, 'addClass', options);
                    },
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 1 hr to fix
              src/ng/animate.js on lines 707..711

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 59.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                for (var i = 0; i < element.length; i++) {
                  var elm = element[i];
                  if (elm.nodeType === ELEMENT_NODE) {
                    return elm;
                  }
              Severity: Major
              Found in src/ng/animate.js and 1 other location - About 1 hr to fix
              src/ngAnimate/shared.js on lines 135..140

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status