jaredhanson/locomotive

View on GitHub

Showing 38 of 62 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 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 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 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 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 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 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 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 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 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 acceptsArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.acceptsArray = function(types, str) {
                    // accept anything when Accept is not present
                    if (!str) { return types[0]; }
                  
                    // 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

                  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

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

                  module.exports = function(container) {
                    if (!container) {
                      try {
                        container = require('electrolyte');
                      } catch (_) {
                  Severity: Minor
                  Found in lib/instantiators/di/constructor.js - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function(container) {
                    if (!container) {
                      try {
                        container = require('electrolyte');
                      } catch (_) {
                  Severity: Minor
                  Found in lib/instantiators/di/factory.js - About 25 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