Showing 9 of 11 total issues
Function loadSource
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Neuter.prototype.loadSource = function(file, done) {
if (_.isString(file)) {
this.loadFileGlob(file, (function(err, files) {
if (err) {
return done(err);
NodeTypes
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
var NodeTypes = {
AssignmentExpression: function (node) {
return [
node.left,
node.right,
Function exports
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(source, functionName, done) {
var program;
try {
Function scanNode
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function scanNode(node, done) {
setImmediate(function () {
if (NodeTypes[node.type] === undefined) {
return done(null, []);
}
Function generateSourceNode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
Neuter.prototype.generateSourceNode = function(sections) {
var sourceNode = new sourceMap.SourceNode(null, null, null);
var beforeOffset = 0;
var afterOffset = 0;
- 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 generateSourceNode
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Neuter.prototype.generateSourceNode = function(sections) {
var sourceNode = new sourceMap.SourceNode(null, null, null);
var beforeOffset = 0;
var afterOffset = 0;
Avoid deeply nested control flow statements. Open
Open
if (argument[0] === '.') {
// the path is relative to the current file,
// prefix with the file's base path
argument = path.join(path.dirname(file.path), argument);
}
Avoid deeply nested control flow statements. Open
Open
for (var i = 0; i < childNode.arguments.length; i++) {
var argument = childNode.arguments[i];
if (argument.type !== 'Literal') {
return done(new Error('Unsupported require argument type: ' + argument.type));
}
Function loadSource
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
Neuter.prototype.loadSource = function(file, done) {
if (_.isString(file)) {
this.loadFileGlob(file, (function(err, files) {
if (err) {
return done(err);
- 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"