Showing 8 of 8 total issues
Function update
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var update = function (library, callback) {
var target = library.autoupdate.target;
var localTarget = path.normalize(path.join(
__dirname, '../', GIT_REPO_LOCAL_FOLDER, library.name
));
Function processNewVersion
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var processNewVersion = function (pkg, version) {
var npmName = pkg.autoupdate.target;
// sometimes the tar is extracted to a dir that isnt called 'package' - get that dir via glob
var extractLibPath = glob.sync(getPackageTempPath(pkg, version) + '/*/')[0];
Function updateLibraryVersion
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var updateLibraryVersion = function(library, tarballUrl, version, cb) {
var npmName = library.autoupdate.target;
if (invalidNpmName(library.name)) {
return cb(error(npmName + " has a malicious package name:" + library.name, error.PKG_NAME));
}
Function update
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var update = function(library, callback) {
var msg;
var target = library.autoupdate.target;
if (!isValidFileMap(library)) {
Function processNewVersion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
var processNewVersion = function (pkg, version) {
var npmName = pkg.autoupdate.target;
// sometimes the tar is extracted to a dir that isnt called 'package' - get that dir via glob
var extractLibPath = glob.sync(getPackageTempPath(pkg, version) + '/*/')[0];
- 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 initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var initialize = function (err) {
if (err) {
console.error('Got an error: ' + err);
} else {
console.log('Starting Auto Update'.cyan);
Consider simplifying this complex logical expression. Open
Open
if (
(allFiles.length !== 0) &&
(
(!library.version) ||
(
Function parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
var parse = function(jsonFile, ignoreMissing, ignoreParseFail) {
var content;
try {
content = fs.readFileSync(jsonFile, 'utf8');
- 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"