deps/npm/lib/cache/add-remote-tarball.js
Function fetchAndShaCheck
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function fetchAndShaCheck (u, tmp, shasum, auth, cb) {
npm.registry.fetch(u, { auth : auth }, function (er, response) {
if (er) {
log.error("fetch failed", u)
return cb(er, response)
Function addRemoteTarball
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function addRemoteTarball (u, pkgData, shasum, auth, cb_) {
Function addRemoteTarball_
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function addRemoteTarball_ (u, tmp, shasum, auth, cb) {
Function fetchAndShaCheck
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function fetchAndShaCheck (u, tmp, shasum, auth, cb) {
Function addRemoteTarball
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function addRemoteTarball (u, pkgData, shasum, auth, cb_) {
assert(typeof u === "string", "must have module URL")
assert(typeof cb_ === "function", "must have callback")
function cb (er, data) {
- 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"