Showing 2,859 of 2,859 total issues
Function newSection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function newSection(tok) {
var section = {};
// infer the type from the text.
var text = section.textRaw = tok.text;
if (text.match(eventExpr)) {
- 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 deeply nested control flow statements. Open
if (!self.paused) {
// Stream must be paused and resumed after SIGCONT to catch
// SIGINT, SIGTSTP, and EOF.
self.pause();
self.emit('SIGCONT');
Function socketOnData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function socketOnData(d) {
var socket = this;
var req = this._httpMessage;
var parser = this.parser;
- 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 deeply nested control flow statements. Open
if (this._sawReturn)
this._sawReturn = false;
else
this._line();
Avoid deeply nested control flow statements. Open
if (match.index === posWithinLine) {
break;
}
Function stableSort
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function stableSort(array, compare) {
assert(Array.isArray(array), 'array must be an array');
if (!compare) {
compare = defaultCompare;
- 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 deeply nested control flow statements. Open
if (base.match(/-\d+\.\d+(\.\d+)?/) || name === '.npm') {
// Exclude versioned names that 'npm' installs.
continue;
}
Avoid deeply nested control flow statements. Open
if (util.isBuffer(s))
s = s.toString('utf-8');
Function processCmdLineArgs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function processCmdLineArgs() {
var cmdLineOpts = {};
var cmdLineArgs = process.argv.splice(2);
for (var i = 0; i < cmdLineArgs.length; ++i) {
- 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 deeply nested control flow statements. Open
if (line.length === 0) {
filter = '';
expr = '';
} else if (line[line.length - 1] === '.') {
filter = '';
Avoid deeply nested control flow statements. Open
if (tmp < 0) {
//more to go, recurse
depth += curr.depth;
workIt();
} else if (tmp > 0) {
Avoid deeply nested control flow statements. Open
for (var subexpression = 0; subexpression < newStyle.length; subexpression++) {
matchedString = bestMatch[subexpression + 1];
output(matchedString, newStyle[subexpression]);
}
Avoid deeply nested control flow statements. Open
if (exts.indexOf(ext) !== -1) {
if (!subdir || base !== 'index') {
group.push(subdir + base);
}
} else {
Avoid deeply nested control flow statements. Open
if (!expr) {
// If context is instance of vm.ScriptContext
// Get global vars synchronously
if (this.useGlobal ||
this.context.constructor &&
Avoid deeply nested control flow statements. Open
if (r.source === '$') {
r.exec = sh_konquerorExec;
}
Avoid deeply nested control flow statements. Open
if (s) {
var lines = s.split(/\r\n|\n|\r/);
for (var i = 0, len = lines.length; i < len; i++) {
if (i > 0) {
this._line();
Avoid deeply nested control flow statements. Open
if (q < t) {
break;
}
Function send
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Socket.prototype.send = function(buffer,
offset,
length,
port,
address,
Function concat
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Buffer.concat = function(list, length) {
if (!util.isArray(list))
throw new TypeError('list argument must be an Array of Buffers.');
if (util.isUndefined(length)) {
- 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 deeply nested control flow statements. Open
for (var j = 0, k = part.length; j < k; j++) {
if (part.charCodeAt(j) > 127) {
// we replace non-ASCII char with a temporary placeholder
// we need this to make sure size of hostname is not
// broken by replacing non-ASCII by nothing