Showing 38 of 62 total issues
Function render
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Controller.prototype.render = function(template, options, fn) {
if (typeof options === 'function') {
fn = options;
options = undefined;
} else if (typeof template === 'function') {
- 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 respondWith
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Controller.prototype.respondWith = function(obj) {
var req = this.__req
, res = this.__res
, format = this.__req.params.format;
format = format ? mime.lookup(format) : undefined;
- 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
File controller.js
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Module dependencies.
*/
var router = require('actionrouter')
, mime = require('express').mime
Function _invoke
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Controller.prototype._invoke = function(action) {
if (typeof this[action] !== 'function') {
return this.__next(new ControllerError(this.__id + '#' + action + ' is not a function'));
}
- 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 server
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function server(dir, address, port, env, options) {
console.log('CLI ENV: ' + env);
options = options || {};
var command, args, proc;
Function _devoke
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Controller.prototype._devoke = function(err, cb) {
if (this.__devoked) { return; }
this.__devoked = true;
var self = this
- 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
File create.js
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Module dependencies.
*/
var prompt = require('co-prompt')
, os = require('os')
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Controller.prototype.render = function(template, options, fn) {
if (typeof options === 'function') {
fn = options;
options = undefined;
} else if (typeof template === 'function') {
Function _invoke
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Controller.prototype._invoke = function(action) {
if (typeof this[action] !== 'function') {
return this.__next(new ControllerError(this.__id + '#' + action + ' is not a function'));
}
Function exports
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(port, address, options) {
var os = require('os')
, http = require('http')
, cluster = require('cluster')
, debug = require('debug')('locomotive');
Function create
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function create(path) {
console.log('creating Locomotive application at : ' + path);
(function createApplication(path) {
emptyDirectory(path, function(empty) {
- 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 respondWith
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Controller.prototype.respondWith = function(obj) {
var req = this.__req
, res = this.__res
, format = this.__req.params.format;
format = format ? mime.lookup(format) : undefined;
Function createApplicationAt
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createApplicationAt(path) {
console.log();
process.on('exit', function(){
console.log();
console.log(' install dependencies:');
Function exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(container) {
if (!container) {
try {
container = require('electrolyte');
} catch (_) {
Function _controller
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Application.prototype._controller = function(id, cb) {
var mod = this.__controllers[id]
, mpath;
if (!mod) {
- 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 server
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = function server(dir, address, port, env, options) {
console.log('CLI ENV: ' + env);
options = options || {};
var command, args, proc;
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(app, options) {
options = options || {};
var name = options.name || 'invoke';
return function invokable(req, res, next) {
- 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 _devoke
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Controller.prototype._devoke = function(err, cb) {
if (this.__devoked) { return; }
this.__devoked = true;
var self = this
Function httpServerCluster
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function httpServerCluster(done) {
port = port || options.port || this.get('port') || 3000;
address = address || options.address || this.get('address') || '0.0.0.0';
if (cluster.isMaster) {
Function exports
has 32 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();