enspiral/rails_karma

View on GitHub

Showing 19 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

              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

                            Avoid too many return statements within this function.
                            Open

                                return true;
                            Severity: Major
                            Found in files/angular-mocks.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language