fvanwijk/mox

View on GitHub

Showing 14 of 27 total issues

Function MoxBuilder has 287 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MoxBuilder() {

  var
    moduleNames,
    moduleFns,
Severity: Major
Found in src/mox.js - About 1 day to fix

    File helpers-spec.js has 566 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    describe('The helper functions', function () {
    
      describe('Test helpers', function () {
        beforeEach(function () {
          angular.module('mox').value('x', 1).value('y', 2);
    Severity: Major
    Found in test/spec/helpers-spec.js - About 1 day to fix

      File mox-spec.js has 556 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      angular.extend(moxConfig, {
        factory2: mox.createMock('factory2', ['methodA']),
        factory3: function ($provide, mock) {
          $provide.value('factory3', mock);
        }
      Severity: Major
      Found in test/spec/mox-spec.js - About 1 day to fix

        Function MoxBuilder has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
        Open

        function MoxBuilder() {
        
          var
            moduleNames,
            moduleFns,
        Severity: Minor
        Found in src/mox.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 requestTest has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function requestTest() {
          var test = {
            _httpMethod: 'GET',
            _data: null
          };
        Severity: Major
        Found in src/helpers.js - About 3 hrs to fix

          Function exports has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (grunt) {
            require('load-grunt-tasks')(grunt);
          
            var paths = {
              src: 'src',
          Severity: Major
          Found in Gruntfile.js - About 3 hrs to fix

            File mox.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            var moxConfig = {};
            angular.module('mox', [])
              .service('Mox', MoxBuilder);
            
            var mox = angular.injector(['mox']).get('Mox');
            Severity: Minor
            Found in src/mox.js - About 3 hrs to fix

              Function requestTest has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              function requestTest() {
                var test = {
                  _httpMethod: 'GET',
                  _data: null
                };
              Severity: Minor
              Found in src/helpers.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 mockServices has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                this.mockServices = function mockServices() {
                  function getMethodNames(obj) {
                    var methodNames = [];
                    angular.forEach(obj, function (method, methodName) {
                      if (angular.isFunction(method)) {
              Severity: Major
              Found in src/mox.js - About 2 hrs to fix

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

                function addSelectors(element, selectors) {
                
                  function checkAndSetFn(obj, prop, fn) {
                    var property = obj[prop];
                    if (angular.isUndefined(property)) {
                Severity: Minor
                Found in src/helpers.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 addSelectors has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function addSelectors(element, selectors) {
                
                  function checkAndSetFn(obj, prop, fn) {
                    var property = obj[prop];
                    if (angular.isUndefined(property)) {
                Severity: Minor
                Found in src/helpers.js - About 1 hr to fix

                  Function setupResults has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    this.setupResults = function setupResults(configFn) {
                      postInjectFns.push(function setupResultsFn() {
                        var config = configFn();
                        angular.forEach(config, function (mockConfig, mockName) {
                          var mock = mox.inject(mockName);
                  Severity: Minor
                  Found in src/mox.js - About 1 hr to fix

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

                        postInjectFns.push(function setupResultsFn() {
                          var config = configFn();
                          angular.forEach(config, function (mockConfig, mockName) {
                            var mock = mox.inject(mockName);
                            if (!(mockName in mox.get)) {
                    Severity: Minor
                    Found in src/mox.js - About 1 hr to fix

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

                        test.run = function run() {
                          test._response = test._response || {};
                          mox.inject('$httpBackend').expect(test._httpMethod, { test: validateUrl }, test._data).respond(test._response);
                      
                          var response = test._method.apply(this, test._methodArguments);
                      Severity: Minor
                      Found in src/helpers.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language