enspiral/rails_karma

View on GitHub

Showing 23 of 23 total issues

File angular-mocks.js has 658 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license AngularJS v1.0.7
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 *
Severity: Major
Found in files/angular-mocks.js - About 1 day to fix

    Function createHttpBackendMock has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

    function createHttpBackendMock($delegate, $browser) {
      var definitions = [],
          expectations = [],
          responses = [],
          responsesPush = angular.bind(responses, responses.push);
    Severity: Minor
    Found in files/angular-mocks.js - About 1 day 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 createHttpBackendMock has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createHttpBackendMock($delegate, $browser) {
      var definitions = [],
          expectations = [],
          responses = [],
          responsesPush = angular.bind(responses, responses.push);
    Severity: Major
    Found in files/angular-mocks.js - About 5 hrs to fix

      Function TzDate has 90 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 files/angular-mocks.js - About 3 hrs to fix

        Function MockHttpExpectation has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        function MockHttpExpectation(method, url, data, headers) {
        
          this.data = data;
          this.headers = headers;
        
        
        Severity: Minor
        Found in files/angular-mocks.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 dump has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        angular.mock.dump = function(object) {
          return serialize(object);
        
          function serialize(object) {
            var out;
        Severity: Minor
        Found in files/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 $Browser has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        angular.mock.$Browser = function() {
          var self = this;
        
          this.isMock = true;
          self.$$url = "http://server/";
        Severity: Major
        Found in files/angular-mocks.js - About 2 hrs to fix

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

          angular.mock.$Browser = function() {
            var self = this;
          
            this.isMock = true;
            self.$$url = "http://server/";
          Severity: Minor
          Found in files/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 $httpBackend has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function $httpBackend(method, url, data, callback, headers) {
              var xhr = new MockXhr(),
                  expectation = expectations[0],
                  wasExpected = false;
          
          
          Severity: Minor
          Found in files/angular-mocks.js - About 1 hr to fix

            Function dump has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            angular.mock.dump = function(object) {
              return serialize(object);
            
              function serialize(object) {
                var out;
            Severity: Minor
            Found in files/angular-mocks.js - About 1 hr to fix

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

                        ($browser ? $browser.defer : responsesPush)(function() {
                          var response = definition.response(method, url, data, headers);
                          xhr.$$respHeaders = response[2];
                          callback(response[0], response[1], xhr.getAllResponseHeaders());
                        });
              Severity: Major
              Found in files/angular-mocks.js and 1 other location - About 1 hr to fix
              files/angular-mocks.js on lines 906..910

              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 64.

              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

                      responses.push(function() {
                        var response = expectation.response(method, url, data, headers);
                        xhr.$$respHeaders = response[2];
                        callback(response[0], response[1], xhr.getAllResponseHeaders());
                      });
              Severity: Major
              Found in files/angular-mocks.js and 1 other location - About 1 hr to fix
              files/angular-mocks.js on lines 921..925

              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 64.

              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

              Function $LogProvider has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              angular.mock.$LogProvider = function() {
              
                function concat(array1, array2, index) {
                  return array1.concat(Array.prototype.slice.call(array2, index));
                }
              Severity: Minor
              Found in files/angular-mocks.js - About 1 hr to fix

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

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

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

                    this.$get = function () {
                      var $log = {
                        log: function() { $log.log.logs.push(concat([], arguments, 0)); },
                        warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
                        info: function() { $log.info.logs.push(concat([], arguments, 0)); },
                  Severity: Minor
                  Found in files/angular-mocks.js - About 1 hr to fix

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

                    function MockHttpExpectation(method, url, data, headers) {
                    
                      this.data = data;
                      this.headers = headers;
                    
                    
                    Severity: Minor
                    Found in files/angular-mocks.js - About 1 hr to fix

                      Function cookies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        cookies:  function(name, value) {
                          if (name) {
                            if (value == undefined) {
                              delete this.cookieHash[name];
                            } else {
                      Severity: Minor
                      Found in files/angular-mocks.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 $ExceptionHandlerProvider has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      angular.mock.$ExceptionHandlerProvider = function() {
                        var handler;
                      
                        /**
                         * @ngdoc method
                      Severity: Minor
                      Found in files/angular-mocks.js - About 1 hr to fix

                        Function serialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function serialize(object) {
                            var out;
                        
                            if (angular.isElement(object)) {
                              object = angular.element(object);
                        Severity: Minor
                        Found in files/angular-mocks.js - About 1 hr to fix

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

                            function $httpBackend(method, url, data, callback, headers) {
                          Severity: Minor
                          Found in files/angular-mocks.js - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language