Showing 7 of 11 total issues
Function _dispatch
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
Open
express.Router.prototype._dispatch = function(req, res, next){
var params = this.params
, 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
Function _dispatch
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
express.Router.prototype._dispatch = function(req, res, next){
var params = this.params
, self = this;
Function pass
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(function pass(i, err){
var paramCallbacks
, paramIndex = 0
, paramVal
, route
Function paramCallback
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function paramCallback(err) {
var fn = paramCallbacks[paramIndex++];
if (err || !fn) return param(err);
var parameters = utils.getParameters(fn);
Function route
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
express.Router.prototype.route = function(method, path) {
var callbacks = utils.flatten([].slice.call(arguments, 2));
callbacks = callbacks
.map(function(fn) {
Function arraysEqual
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
exports.arraysEqual = function(arr1, arr2) {
if (arr1 === arr2) return true;
if (arr1 === null || arr2 === null) return false;
if (arr1.length != arr2.length) return false;
- 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
Avoid too many return
statements within this function. Open
Open
return true;