drudge/locomotive

View on GitHub

Showing 44 of 72 total issues

Function exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(controller, action, placeholders, onlyPath) {

  return function(obj) {
    if (arguments.length !== placeholders.length) { throw new Error('Incorrect number of arguments passed to route helper for ' + controller + '#' + action); }

Severity: Minor
Found in lib/helpers/route/entry.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 urlFor has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function urlFor(req, res) {

  return function(options) {
    options = options || {};
    var app = req._locomotive.app;
Severity: Minor
Found in lib/helpers/dynamic/url.js - About 1 hr to fix

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

    module.exports = function(env) {
      env = env || process.env.NODE_ENV || 'development';
      var self = this
        , app = express();
    
    
    Severity: Minor
    Found in lib/underlay/express.js - About 1 hr to fix

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

      Controller.prototype._prepare = function(req, res, next) {
        this.__req = req;
        this.__res = res;
        this.__next = next;
      
      
      Severity: Minor
      Found in lib/controller.js - About 1 hr to fix

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

        exports.path = function(pattern) {
          // from underlay/express.js#L49
          var keys = []
            , placeholders = [];
          // TODO: Implement support for 'sensitive' and 'strict' options
        Severity: Minor
        Found in lib/helpers/route/pattern.js - About 1 hr to fix

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

            return function httpsServerCluster(done) {
              port = port || options.port || this.get('ssl port') || 4000;
              address = address || options.address || this.get('ssl address') || '0.0.0.0';
          
              if (cluster.isMaster) {
          Severity: Minor
          Found in lib/boot/httpsservercluster.js - About 1 hr to fix

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

              (function iter(err, data) {
                if (err) { return self.error(err); }
            
                filter = filters[i++];
                if (!filter) {
            Severity: Minor
            Found in lib/controller.js - About 1 hr to fix

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

              module.exports = function(port, address, options) {
                var os = require('os')
                  , http = require('http')
                  , cluster = require('cluster')
                  , debug = require('debug')('locomotive');
              Severity: Minor
              Found in lib/boot/httpservercluster.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 tag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function tag(name, options, close, cb) {
                if (typeof close === 'function') {
                  cb = close;
                  close = true;
                }
              Severity: Minor
              Found in lib/helpers/tag.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(port, address, options) {
                var os = require('os')
                  , http = require('https')
                  , cluster = require('cluster')
                  , debug = require('debug')('locomotive');
              Severity: Minor
              Found in lib/boot/httpsservercluster.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 instantiate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              Instantiator.prototype.instantiate = function(mod, id, cb) {
                var mechs = this._mechs
                  , idx = 0;
              
                function next(err, inst) {
              Severity: Minor
              Found in lib/instantiator.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 tag has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function tag(name, options, close, cb) {
                if (typeof close === 'function') {
                  cb = close;
                  close = true;
                }
              Severity: Minor
              Found in lib/helpers/tag.js - About 1 hr to fix

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

                module.exports = function(options, container) {
                  if (!container) {
                    try {
                      container = require('electrolyte');
                    } catch (_) {
                Severity: Minor
                Found in lib/boot/di/routes.js - About 1 hr to fix

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

                    (function iter(err) {
                      filter = filters[i++];
                      if (!filter) {
                        // filters done
                        cb && cb(err);
                  Severity: Minor
                  Found in lib/controller.js - About 1 hr to fix

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

                    Application.prototype._controller = function(id, cb) {
                      var mod = this.__controllers[id]
                        , mpath;
                    
                      if (!mod) {
                    Severity: Minor
                    Found in lib/application.js - About 1 hr to fix

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

                      module.exports = function(options, container) {
                        if (!container) {
                          try {
                            container = require('electrolyte');
                          } catch (_) {
                      Severity: Minor
                      Found in lib/boot/di/routes.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 before has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Controller.prototype.before = function(action, fn) {
                        var i, len;
                      
                        // If an array of filters is passed as an argument, decompose the array into
                        // its constituent arguments.
                      Severity: Minor
                      Found in lib/controller.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 params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Controller.prototype.params = function(name, defaultValue) {
                        if (typeof this.__req.params === 'object' && this.__req.params.hasOwnProperty(arguments[0])) {
                          return this.__req.params[arguments[0]];
                        } else if (typeof this.__req.body === 'object' && this.__req.body.hasOwnProperty(arguments[0])) {
                          return this.__req.body[arguments[0]];
                      Severity: Minor
                      Found in lib/controller.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 exports has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      exports = module.exports = function server(dir, address, port, env, options) {
                      Severity: Minor
                      Found in lib/cli/server.js - About 35 mins to fix

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

                        exports.acceptedViaArray = function(types, str) {
                          // not accepted by anything when Accept is not present
                          if (!str) { return undefined; }
                        
                          // parse
                        Severity: Minor
                        Found in lib/utils.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