catarse/catarse.js

View on GitHub
legacy/spec/lib/jasmine-ajax/mock-ajax.js

Summary

Maintainability
F
1 wk
Test Coverage

Function AjaxFakeRequest has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
Open

getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
  function extend(destination, source, propertiesToSkip) {
    propertiesToSkip = propertiesToSkip || [];
    for (var property in source) {
      if (!arrayContains(propertiesToSkip, property)) {
Severity: Minor
Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 2 days 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 AjaxFakeRequest has 257 lines of code (exceeds 25 allowed). Consider refactoring.
Open

getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
  function extend(destination, source, propertiesToSkip) {
    propertiesToSkip = propertiesToSkip || [];
    for (var property in source) {
      if (!arrayContains(propertiesToSkip, property)) {
Severity: Major
Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

    File mock-ajax.js has 579 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
    
    Jasmine-Ajax - v3.1.1: a set of helpers for testing AJAX requests under the Jasmine
    BDD framework for JavaScript.
    
    
    Severity: Major
    Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

      Function fakeRequest has 211 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function fakeRequest(global, requestTracker, stubTracker, paramParser) {
          function FakeXMLHttpRequest() {
            requestTracker.track(this);
            this.eventBus = eventBusFactory(this);
            initializeEvents(this);
      Severity: Major
      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 day to fix

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

        getJasmineRequireObj().AjaxRequestStub = function() {
          var RETURN = 0,
              ERROR = 1,
              TIMEOUT = 2;
        
        
        Severity: Minor
        Found in legacy/spec/lib/jasmine-ajax/mock-ajax.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 AjaxRequestStub has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        getJasmineRequireObj().AjaxRequestStub = function() {
          var RETURN = 0,
              ERROR = 1,
              TIMEOUT = 2;
        
        
        Severity: Major
        Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 2 hrs to fix

          Function AjaxEventBus has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          getJasmineRequireObj().AjaxEventBus = function(eventFactory) {
            function EventBus(source) {
              this.eventList = {};
              this.source = source;
            }
          Severity: Minor
          Found in legacy/spec/lib/jasmine-ajax/mock-ajax.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 RequestStub has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function RequestStub(url, stubData, method) {
              var normalizeQuery = function(query) {
                return query ? query.split('&').sort().join('&') : undefined;
              };
          
          
          Severity: Major
          Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 2 hrs to fix

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

            getJasmineRequireObj().AjaxParamParser = function() {
              function ParamParser() {
                var defaults = [
                  {
                    test: function(xhr) {
            Severity: Minor
            Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

              getJasmineRequireObj().AjaxRequestTracker = function() {
                function RequestTracker() {
                  var requests = [];
              
                  this.track = function(request) {
              Severity: Minor
              Found in legacy/spec/lib/jasmine-ajax/mock-ajax.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 AjaxEventBus has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              getJasmineRequireObj().AjaxEventBus = function(eventFactory) {
                function EventBus(source) {
                  this.eventList = {};
                  this.source = source;
                }
              Severity: Minor
              Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

                  function ParamParser() {
                    var defaults = [
                      {
                        test: function(xhr) {
                          return (/^application\/json/).test(xhr.contentType());
                Severity: Minor
                Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

                  getJasmineRequireObj().AjaxParamParser = function() {
                    function ParamParser() {
                      var defaults = [
                        {
                          test: function(xhr) {
                  Severity: Minor
                  Found in legacy/spec/lib/jasmine-ajax/mock-ajax.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 AjaxRequestTracker has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  getJasmineRequireObj().AjaxRequestTracker = function() {
                    function RequestTracker() {
                      var requests = [];
                  
                      this.track = function(request) {
                  Severity: Minor
                  Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

                    Function MockAjax has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    getJasmineRequireObj().MockAjax = function($ajax) {
                      function MockAjax(global) {
                        var requestTracker = new $ajax.RequestTracker(),
                          stubTracker = new $ajax.StubTracker(),
                          paramParser = new $ajax.ParamParser(),
                    Severity: Minor
                    Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

                      Function RequestTracker has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function RequestTracker() {
                          var requests = [];
                      
                          this.track = function(request) {
                            requests.push(request);
                      Severity: Minor
                      Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

                          function MockAjax(global) {
                            var requestTracker = new $ajax.RequestTracker(),
                              stubTracker = new $ajax.StubTracker(),
                              paramParser = new $ajax.ParamParser(),
                              realAjaxFunction = global.XMLHttpRequest,
                        Severity: Minor
                        Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

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

                          getJasmineRequireObj().AjaxEvent = function() {
                            function now() {
                              return new Date().getTime();
                            }
                          
                          
                          Severity: Minor
                          Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 1 hr to fix

                            Function AjaxStubTracker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            getJasmineRequireObj().AjaxStubTracker = function() {
                              function StubTracker() {
                                var stubs = [];
                            
                                this.addStub = function(stub) {
                            Severity: Minor
                            Found in legacy/spec/lib/jasmine-ajax/mock-ajax.js - About 35 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

                            There are no issues that match your filters.

                            Category
                            Status