Showing 948 of 948 total issues
Avoid deeply nested control flow statements. Open
Open
if(bb.stack[l].right.$ !== undefined){
switch(bb.stack[l].right.__type__){
case STUB_TYPE.CLASS:
bb.stack[l].right = db[bb.stack[l].right.id];
Function flattening
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
Analyzer.prototype.flattening = function(method){
let instr = [], meta={};
for(let i in method.instr){
meta = {
label: (method.instr[i].tag !== null)? method.instr[i].tag : null,
- 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
Open
if(this.isImm(regX)){
this.setSymbol(regX, regX.add(regV.getValue(), oper.opcode.byte));
}
Avoid deeply nested control flow statements. Open
Open
else if(i == "package"){
obj.package = this.package.toJsonObject(["name"]);
}
else if(i == "tags"){
obj.tags = this.tags;
Avoid deeply nested control flow statements. Open
Open
for(let j in src.fields[k]._callers){
tab[fieldSign]._callers.push(
new CircularReference(
STUB.METHOD,
src.fields[k]._callers[j].name
Avoid deeply nested control flow statements. Open
Open
for(let k in this.fields){
m = this.fields[k].toJsonObject(["__signature__","__aliasedSignature__","alias","name","tags","type","modifiers"]);
if(this.inherit[k] != null) m.__inherit = true;
obj.fields.push(m);
}
Avoid deeply nested control flow statements. Open
Open
for(let j in src.methods[k]._callers){
tab[id]._callers.push(
new CircularReference(
STUB.METHOD,
src.methods[k]._callers[j].signature()
Avoid deeply nested control flow statements. Open
Open
if(this._useClass[i] != undefined)
obj._useClass.push(this._useClass[i].name);
Avoid deeply nested control flow statements. Open
Open
if(this._callers[j] != undefined)
if(this._callers[j] instanceof Method){
//console.log("Callers -> ",this._callers[i].signature());
obj._callers.push(this._callers[j].signature());
}else{
Avoid deeply nested control flow statements. Open
Open
if(this.isImm(regV))
v+= this.getImmediateValue(regV)+',';
else
v+= regX+',';
Avoid deeply nested control flow statements. Open
Open
if(next.hasPredecessor(blocks[i])==false){
next.addPredecessor(blocks[i]);
}
Avoid deeply nested control flow statements. Open
Open
if(this.__tmp_block.width!=null){
this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
this.__tmp_block = new CLASS.BasicBlock();
this.__tmp_block.setAsGotoBlock(sml[0].split('_')[1]);
}else{
Avoid deeply nested control flow statements. Open
Open
if(succ[i].isConditionalBlock()){
cont = source.pop();
source.push(cont+'{');
}else{
source.push(`${" ".repeat(pDepth)}else{`);
Avoid deeply nested control flow statements. Open
Open
for(let m in src.methods[k]._useMethod[l]){
tab[id]._useMethod[l][m] = new CircularReference(
STUB.METHOD,
l
);
Avoid deeply nested control flow statements. Open
Open
for(let m in src.methods[k]._useClass[l]){
tab[id]._useClass[l][m] = new CircularReference(
STUB.CLASS,
l
);
Avoid deeply nested control flow statements. Open
Open
if(this.supers[k] instanceof Class)
obj.supers.push({
name:this.supers[k].signature(),
alias: this.supers[k].getAlias()
}); // call signature
Avoid deeply nested control flow statements. Open
Open
if(this.simplify >= 1 && this.isImm(regV))
v += `${this.getImmediateValue(regV)},`;
else{
v += `${tmp},`;
}
Function method
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
method: function(db, methRef, isStaticCall){
let meth = db.methods.getEntry(methRef.signature());
// 1. search into indexed method
- 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
Open
else if(sml[0].indexOf(':try_end')>-1){
this.__tmp_block.setTryEndName(sml[0]);
if(this.__tmp_block != null){
this.__tmp_meth.appendBlock(this.__tmp_block, this.__appendBlock_callback);
Avoid deeply nested control flow statements. Open
Open
if(instruct.right === undefined || instruct.right._callers === undefined){
Logger.debug("[SAST] Call : method cannot be resolved : ", instruct);
}