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); }
- Read upRead up
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;
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) {
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
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');
- Read upRead up
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) {
- Read upRead up
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;
}
- Read upRead up
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 (_) {
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;
}
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);
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) {
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 (_) {
- Read upRead up
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.
- Read upRead up
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) {
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
- Read upRead up
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
- Read upRead up
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 (_) {
- Read upRead up
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 (_) {
- Read upRead up
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"