Function makeEnv
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
function makeEnv (data, prefix, env) {
prefix = prefix || "npm_package_"
if (!env) {
env = {}
for (var i in process.env) if (!i.match(/^npm_/)) {
- 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
File lifecycle.js
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
exports = module.exports = lifecycle
exports.cmd = cmd
exports.makeEnv = makeEnv
var log = require("npmlog")
Function makeEnv
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeEnv (data, prefix, env) {
prefix = prefix || "npm_package_"
if (!env) {
env = {}
for (var i in process.env) if (!i.match(/^npm_/)) {
Function runCmd_
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) {
function cb (er) {
cb_.apply(null, arguments)
log.resume()
Function lifecycle_
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) {
var pathArr = []
, p = wd.split("node_modules")
, acc = path.resolve(p.shift())
Function runCmd_
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) {
Function runCmd_
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) {
function cb (er) {
cb_.apply(null, arguments)
log.resume()
- 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 lifecycle_
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) {
var pathArr = []
, p = wd.split("node_modules")
, acc = path.resolve(p.shift())
- 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 runCmd
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
Function runCmd
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function runCmd (note, cmd, pkg, env, stage, wd, unsafe, cb) {
if (running) {
queue.push([note, cmd, pkg, env, stage, wd, unsafe, cb])
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 lifecycle_
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) {
Function lifecycle
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function lifecycle (pkg, stage, wd, unsafe, failOk, cb) {
Function lifecycle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function lifecycle (pkg, stage, wd, unsafe, failOk, cb) {
if (typeof cb !== "function") cb = failOk, failOk = false
if (typeof cb !== "function") cb = unsafe, unsafe = false
if (typeof cb !== "function") cb = wd, wd = null
- 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 runPackageLifecycle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function runPackageLifecycle (pkg, env, wd, unsafe, cb) {
Function runHookLifecycle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function runHookLifecycle (pkg, env, wd, unsafe, cb) {