Showing 14 of 18 total issues
Function runQueue
has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring. Open
function runQueue () {
queueRunning = true;
console.log('runQueue: starting with ' + queue.length + ' tasks.');
- 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 runTasks
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function runTasks (task, options) {
for (var i = 0; i < task.length; i++) {
var q = task[i];
// checking if source folder is valid
- 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 runQueue
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runQueue () {
queueRunning = true;
console.log('runQueue: starting with ' + queue.length + ' tasks.');
File symlinker.js
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
var mkdirp = require('mkdirp');
var path = require('path');
var fs = require('fs');
Function open
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
function open (options) {
var rawFile;
// options:
// -path
// -type
Function runTasks
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function runTasks (task, options) {
for (var i = 0; i < task.length; i++) {
var q = task[i];
// checking if source folder is valid
Function open
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function open (options) {
var rawFile;
// options:
// -path
// -type
- 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 basic
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function basic (sourcePath, destinationPath, options, callback) {
try {
if (fs.lstatSync(destinationPath).isSymbolicLink()) {
if (!options.recreateSymbolicLinks) {
process.nextTick(function () {
Function basic
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function basic (sourcePath, destinationPath, options, callback) {
try {
if (fs.lstatSync(destinationPath).isSymbolicLink()) {
if (!options.recreateSymbolicLinks) {
process.nextTick(function () {
- 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 (!options.forceRecreation) {
console.log("Symbolic link " + outputPath + " already exists.\nUse -r to force symbolic link recreation.");
process.exit(1);
} else {
fs.unlinkSync(outputPath);
Avoid deeply nested control flow statements. Open
for (var i = 0; i < currentTask.files.length; i++) {
var currentFile = currentTask.files[i];
var fileName = (currentFile.name) ? currentFile.name : currentFile.path;
Avoid deeply nested control flow statements. Open
if (!currentTask.options.recreateSymbolicLinks) { // not allowed to unlink symbolic links
// process queue
console.error('runQueue: error - destination is symlink', fileDestinationPath);
currentTask.failed = true;
currentTask.callback(new Error('Could not create symbolic link. Destination is already a symbolic link.'), null);
Avoid deeply nested control flow statements. Open
if (fileSourceStats.isDirectory()) {
fs.symlinkSync(fileSourcePath, fileDestinationPath, 'dir');
} else if (fileSourceStats.isFile()) {
fs.symlinkSync(fileSourcePath, fileDestinationPath, 'file');
} else {
Avoid deeply nested control flow statements. Open
} else if (fileDestinationExisting) {
if (!currentTask.options.ignoreExisting) {
console.error('runQueue: error - file already existing', fileDestinationPath);
currentTask.failed = true;
currentTask.callback(new Error('Could not create symbolic link. Source file is invalid.'), null);