Showing 6 of 6 total issues
Function parseFile
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function parseFile (file) {
var method;
var module = require(file);
var handlers = [];
var parsed;
- 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 func
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Handler.prototype.func = function (direct) {
var handler = this;
var func = require(this.file)[this.funcName];
return function (req, res, next) {
Function parseFile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseFile (file) {
var method;
var module = require(file);
var handlers = [];
var parsed;
Function parsePath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function parsePath (file, action, method) {
var pathArr = file.replace(resourceDir, '').split('/');
pathArr.pop(); // Remove the script file from the path, will be replaced with the action
pathArr.shift(); // Remove empty string at front
- 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 Handler
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function Handler (file, method, path, isCustom, funcName, config) {
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (di, options) {
var serviceDir = options.serviceDir;
if ( !fs.existsSync(serviceDir) ) return;
- 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"