Showing 30 of 48 total issues
Function getTasks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
PersistentTaskContext.prototype.getTasks = Q.async(function*(offset, count) {
var tasks = [];
if (offset < this._tasksInMemory.length) {
tasks = this._tasksInMemory.slice(offset, offset + count);
count -= tasks.length;
- 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
for (name in object) {
if (name[0] == '_' || name in dest)
continue;
var result = extract(object[name], true /* only primitives */);
if (result !== null)
Function perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
LoadSiteTask.prototype.perform = function*() {
try {
this.cd(this.site.path);
yield this.exec("git fetch");
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
ResetTask.prototype.perform = function*() {
var site = this.site;
var backupRevision = yield this.runNested(this.site.backupTask("pre-reset"));
- 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 too many return
statements within this function. Open
return dest;
Avoid too many return
statements within this function. Open
return 'upgrade available (' + site.behindBy + ' commits), to ' + site.upstreamRevision;
Function perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
InitDataDirectoryTask.prototype.perform = function*() {
var site = this.site;
var dataPath = fs.join(site.path, 'data');
this.cd(site.path);
this.doLog('data does not exist or is not a git repository, initializing it...'.yellow.bold);
- 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 perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
RestoreTask.prototype.perform = function*() {
var site = this.site;
var dataPath = fs.join(site.path, 'data');
if (!(yield fs.exists(dataPath + '/.git')))
- 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 runNestedQuietly
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Task.prototype.runNestedQuietly = function(task, veryQuiet) {
if (!veryQuiet)
this.doLog('run: '.bold.blue + task.name.blue);
task.start();
return task.catch(function(err) {
- 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 connect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
exports.connect = Q.async(function*(options) {
options = Object.create(options);
options.multipleStatements = true;
var connection = mysql.createConnection(options);
- 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"