kwiniarski/spiral

View on GitHub

Showing 15 of 17 total issues

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

module.exports = function (grunt) {
  'use strict';

  function readCodeclimateTokenFile() {
    var filename = './codeclimate.txt';
Severity: Major
Found in Gruntfile.js - About 3 hrs to fix

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

    module.exports = function (req, res, next) {
    
      var finishedAt = null;
    
      if (req && req._startedAt) {
    Severity: Major
    Found in middleware/response.js - About 2 hrs to fix

      Function resourceActionBlueprint has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function resourceActionBlueprint(model, mountPath) {
      
        var proto = Object.create({});
      
        defineProperty(proto, 'model', model);
      Severity: Major
      Found in lib/resource/action-blueprint.js - About 2 hrs to fix

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

        function PolicyConfig(configData) {
          var config = readConfig(configData);
        
          for (var key in config) {
            var record = config[key];
        Severity: Minor
        Found in lib/policy/config.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 agregateActions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        Resource.prototype.agregateActions = function (actions) {
          var mountPaths = {};
        
          for (var i in actions) {
            var action = actions[i];
        Severity: Minor
        Found in lib/resource/index.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 resourceActionBlueprint has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function resourceActionBlueprint(model, mountPath) {
        
          var proto = Object.create({});
        
          defineProperty(proto, 'model', model);
        Severity: Minor
        Found in lib/resource/action-blueprint.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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = function (req, res, next) {
        
          var finishedAt = null;
        
          if (req && req._startedAt) {
        Severity: Minor
        Found in middleware/response.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 PolicyConfig has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function PolicyConfig(configData) {
          var config = readConfig(configData);
        
          for (var key in config) {
            var record = config[key];
        Severity: Minor
        Found in lib/policy/config.js - About 1 hr to fix

          Function validateAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function validateAction(config) {
          
            if (!config.id || typeof config.id !== 'string' && config.id.length > 0) {
              throw new TypeError('ResourceAction(config.id) needs to be a non empty string');
            }
          Severity: Minor
          Found in lib/resource/action.js - About 55 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

          Function resolveMountPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function resolveMountPath(model, controller) {
            var mountPath = null;
            if (controller && controller.path) {
              mountPath = controller.path;
            }
          Severity: Minor
          Found in lib/resource/index.js - About 55 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

          Function RequestError has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function RequestError(status, message) {
          
            /**
             * Instance property which shouldn't be enumerable because
             * we don't want to list stored stack traces in serialized data.
          Severity: Minor
          Found in lib/errors.js - About 45 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

          Function validateTypeOfArrayRecords has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function validateTypeOfArrayRecords(array, name, type) {
            if (!array || !array instanceof Array) {
              throw new TypeError('ResourceAction(config.' + name + ') needs to be an Array');
            } else {
              for (var i = 0, j = array.length; i < j; i++) {
          Severity: Minor
          Found in lib/resource/action.js - About 45 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

          Function getRouter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          Resource.prototype.getRouter = function () {
            var resourceRouter = router()
              , actions = this.agregateActions(this.actions)
              , replaced = this.agregateActions(this.replaced);
          
          
          Severity: Minor
          Found in lib/resource/index.js - About 45 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

          Function actionWrapper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function actionWrapper(handler) {
          
            if (handler.wrapped === true) {
              return handler;
            }
          Severity: Minor
          Found in lib/resource/action-wrapper.js - About 45 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

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

          function Resource(model, controller, policies) {
          
            var blueprint = {}
              , actions = controller ? controller.actions : null;
          
          
          Severity: Minor
          Found in lib/resource/index.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

          Severity
          Category
          Status
          Source
          Language