Showing 213 of 1,102 total issues
Avoid deeply nested control flow statements. Open
Open
if (existingSysIds && existingSysIds.length > 0) {
schemeid.updateJobId.sync(null, existingSysIds,operation.scheme, operation.jobId);
if (existingSysIds.length < sysIdInChunk.size()) {
var setExistSysId = new sets.StringSet(existingSysIds);
Avoid deeply nested control flow statements. Open
Open
for (var j = 0; j < records.length; j++) {
schemeid.save(records[j], function (err) {
if (err) {
error = true;
Avoid deeply nested control flow statements. Open
Open
if (schemeIdRecord != null) {
schemeIdRecord.jobId = operation.jobId;
schemeid.save.sync(null, schemeIdRecord);
canContinue = false;
Avoid deeply nested control flow statements. Open
Open
if (true) { // previously request.systemIds.length>10
idDM.generateSctids(request, function (err) {
if (err) {
lightJob.status = "3";
Avoid deeply nested control flow statements. Open
Open
if (!request.systemIds || request.systemIds.length == 0) {
var arrayUuids = [];
for (var i = 0; i < request.quantity; i++) {
arrayUuids.push(guid());
}
Avoid deeply nested control flow statements. Open
Open
if (cont == records.length) {
callback(null);
return;
}
Avoid deeply nested control flow statements. Open
Open
if (!data) {
callback("Scheme not found for key:" + JSON.stringify(key));
return;
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
error = true;
callback(err);
return;
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
console.log("Error-3 in back end service:" + JSON.stringify(err));
return;
} else {
console.log("End job " + record.name + " - id:" + record.id);
Avoid deeply nested control flow statements. Open
Open
for (i = 0; i < records.length; i++) {
if (records[i][1] == code) {
break;
}
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
callback(err);
} else {
callback(null);
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
console.log("Error-3 in back end service:" + JSON.stringify(err));
return;
} else {
console.log("End job " + record.name + " - id:" + record.id);
Avoid deeply nested control flow statements. Open
Open
if (i > -1 && i < records.length) {
console.log("pos i:" + i);
var data = getScheme.sync(null, key);
if (!data) {
callback("Scheme not found for key:" + JSON.stringify(key));
Avoid deeply nested control flow statements. Open
Open
if (ret){
throw ret;
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
lightJob.status = "3";
if (typeof err == "object") {
lightJob.log = JSON.stringify(err);
} else {
Avoid deeply nested control flow statements. Open
Open
} else if (request.type == job.JOBTYPE.deprecateSctids) {
request.action = stateMachine.actions.deprecate;
idDM.updateSctids(request, function (err) {
if (err) {
Avoid deeply nested control flow statements. Open
Open
if (diff) {
sysIdToCreate = diff;
}
Avoid deeply nested control flow statements. Open
Open
if (typeof err == "object") {
lightJob.log = JSON.stringify(err);
} else {
lightJob.log = err;
}
Avoid deeply nested control flow statements. Open
Open
if (err) {
lightJob.status = "3";
if (typeof err == "object") {
lightJob.log = JSON.stringify(err);
} else {
Function editNamespace
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports.editNamespace = function editNamespace(id, editedNamespace, callback) {
dbInit.getDB(function (err, pdb, model) {
if (err)
throw err;
else{
- 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"