Showing 4 of 4 total issues
Function recursiveDelete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
'recursiveDelete': function (path) {
var self = this;
if (!self.pathExists(path)) 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"
Further reading
Function assert
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
'assert': function (type, o, message) {
var self = this;
message = message || 'Invalid type: expected ' + type + ', got ' + o.toString();
- 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
Consider simplifying this complex logical expression. Open
Open
if (type == 'defined' && !!!o || type === 'number' && isNaN(o) || typeof method === 'function' && !method(o)) {
if (typeof message === 'function') {
message();
}
Consider simplifying this complex logical expression. Open
Open
if (options.autoEncode && (self.hasFileExtension(filename, 'txt') || self.hasFileExtension(filename, 'tmpl') || self.hasFileExtension(filename, 'html') || self.hasFileExtension(filename, 'styl') || self.hasFileExtension(filename, 'js'))) {
return fs.readFileSync(path, 'utf8');
}
else {
return fs.readFileSync(path);