Showing 72 of 568 total issues
Function getStream
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getStream(inputStream, opts) {
if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
}
Function patchLchmod
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function patchLchmod (fs) {
fs.lchmod = function (path, mode, callback) {
fs.open( path
, constants.O_WRONLY | constants.O_SYMLINK
, mode
Function asyncMap
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function asyncMap () {
var steps = Array.prototype.slice.call(arguments)
, list = steps.shift() || []
, cb_ = steps.pop()
if (typeof cb_ !== "function") throw new Error(
Function sync
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
mkdirP.sync = function sync (p, opts, made) {
if (!opts || typeof opts !== 'object') {
opts = { mode: opts };
}
Function handleThenable
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleThenable(promise, value) {
var resolved;
try {
if (promise === value) {
Function shouldUseNative
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
Function writeFile
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function writeFile (filename, data, options, callback) {
if (options instanceof Function) {
callback = options
options = null
}
Function WriteStream
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WriteStream (path, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
Stream.call(this);
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (req, time) {
if (req.timeoutTimer) {
return req;
}
Function exports
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (opts) {
opts = objectAssign({}, opts);
var array = opts.array;
var encoding = opts.encoding;
- 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 all
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Promise.all = function (promises) {
if (!Array.isArray(promises)) {
throw new TypeError('You must pass an array to Promise.all().');
}
- 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 all
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Promise.all = function (promises) {
if (!Array.isArray(promises)) {
throw new TypeError('You must pass an array to Promise.all().');
}
Consider simplifying this complex logical expression. Open
if (isWindows) {
path = process.env.TEMP ||
process.env.TMP ||
(process.env.SystemRoot || process.env.windir) + '\\temp';
} else {
Function handleThenable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function handleThenable(promise, value) {
var resolved;
try {
if (promise === value) {
- 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 memo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function memo (key, lookup, fallback) {
var fell = false
var falling = false
exports[key] = function (cb) {
var val = lookup()
- 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 v4
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function v4(options, buf, offset) {
// Deprecated - 'format' argument, as supported in v1.2
var i = buf && offset || 0;
if (typeof(options) == 'string') {
- 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 (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next);
broken = true;
break;
Avoid deeply nested control flow statements. Open
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, args[i+1]);
i++;
Avoid deeply nested control flow statements. Open
if (letters[j+1] && letters[j+1].match(/\W/)) {
setArg(letters[j], arg.slice(j+2));
broken = true;
break;
}
Function invokeCallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function invokeCallback(subscriber) {
var owner = subscriber.owner;
var settled = owner._state;
var value = owner._data;
var callback = subscriber[settled];
- 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"