deps/npm/lib/cache/add-remote-git.js
File add-remote-git.js
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var assert = require('assert')
var crypto = require('crypto')
var fs = require('graceful-fs')
var path = require('path')
var url = require('url')
Function checkoutTreeish
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function checkoutTreeish (from, resolvedURL, resolvedTreeish, tmpdir, cb) {
var args = ['checkout', resolvedTreeish]
git.whichAndExec(
args,
{ cwd: tmpdir, env: gitEnv() },
Function resolveHead
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resolveHead (from, cloneURL, treeish, cachedRemote, cb) {
log.verbose('resolveHead', from, 'original treeish:', treeish)
var args = ['rev-list', '-n1', treeish]
git.whichAndExec(
args,
Function addRemoteGit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
function addRemoteGit (uri, _cb) {
assert(typeof uri === 'string', 'must have git URL')
assert(typeof _cb === 'function', 'must have callback')
var cb = dezalgo(_cb)
- 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 mirrorRemote
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mirrorRemote (from, cloneURL, treeish, cachedRemote, silent, cb) {
mkdir(cachedRemote, function (er) {
if (er) return cb(er)
var args = [
Function tryClone
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function tryClone (from, combinedURL, silent, cb) {
log.silly('tryClone', 'cloning', from, 'via', combinedURL)
var normalized = normalizeGitUrl(combinedURL)
var cloneURL = normalized.url
Function mirrorRemote
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function mirrorRemote (from, cloneURL, treeish, cachedRemote, silent, cb) {
Function cloneResolved
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function cloneResolved (from, resolvedURL, resolvedTreeish, cachedRemote, tmpdir, cb) {
Function resolveHead
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function resolveHead (from, cloneURL, treeish, cachedRemote, cb) {
Function resetRemote
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function resetRemote (from, cloneURL, treeish, cachedRemote, cb) {
Function validateExistingRemote
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function validateExistingRemote (from, cloneURL, treeish, cachedRemote, cb) {
Function updateRemote
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function updateRemote (from, cloneURL, treeish, cachedRemote, cb) {
Function setPermissions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function setPermissions (from, cloneURL, treeish, cachedRemote, cb) {
Function checkoutTreeish
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function checkoutTreeish (from, resolvedURL, resolvedTreeish, tmpdir, cb) {