Showing 1,675 of 1,675 total issues
Avoid deeply nested control flow statements. Open
Open
if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "left";
else ctx.textAlign="right";
Avoid deeply nested control flow statements. Open
Open
if (distance < 10) {
annotateDIV.style.border = config.annotateBorder;
annotateDIV.style.padding = config.annotatePadding;
annotateDIV.style.borderRadius = config.annotateBorderRadius;
Avoid deeply nested control flow statements. Open
Open
if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
else lgtxt2 = "";
Avoid deeply nested control flow statements. Open
Open
if(config.inGraphDataYPosition==1) { yPos=xAxisPosY - config.inGraphDataPaddingY; }
else if(config.inGraphDataYPosition==2) { yPos=xAxisPosY -(calculateOffset(config, data.datasets[i].data[j], calculatedScale, scaleHop) + (config.barStrokeWidth / 2))/2- config.inGraphDataPaddingY; }
else if(config.inGraphDataYPosition==3) { yPos=xAxisPosY -calculateOffset(config, data.datasets[i].data[j], calculatedScale, scaleHop) + (config.barStrokeWidth / 2)- config.inGraphDataPaddingY; }
Avoid deeply nested control flow statements. Open
Open
self.expert_judgement_instance.nil? ? 'Undefined model' : self.expert_judgement_instance.to_s(self)
Avoid deeply nested control flow statements. Open
Open
if (bw.ie4 || bw.ie5) y = y + eval(scrolled);
Avoid deeply nested control flow statements. Open
Open
else if(config.inGraphDataAlign=="to-center"){
if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "right";
else ctx.textAlign="left";
}
else ctx.textAlign = config.inGraphDataAlign;
Avoid deeply nested control flow statements. Open
Open
else if(config.inGraphDataVAlign=="to-center"){
if((posAngle> Math.PI && posAngle<2*Math.PI) || (posAngle< 0 && posAngle>-Math.PI) || (posAngle< -2*Math.PI && posAngle>-3*Math.PI))ctx.textBaseline = "bottom";
else ctx.textBaseline = "top";
}
else ctx.textBaseline = config.inGraphDataVAlign;
Avoid deeply nested control flow statements. Open
Open
if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
else lgtxt2 = "";
Avoid deeply nested control flow statements. Open
Open
if (nbcols == nbLegendCols) {
nbcols = 0;
xpos = xFirstLegendTextPos;
ypos += config.legendFontSize + config.legendSpaceBetweenTextVertical;
}
Avoid deeply nested control flow statements. Open
Open
unless pf.nil?
pf.views_widget_id = widget_copy.id
pf.save
end
Avoid deeply nested control flow statements. Open
Open
if(config.inGraphDataXPosition==1) { xPos=barOffset+config.inGraphDataPaddingX; }
else if(config.inGraphDataXPosition==2) { xPos=barOffset+barWidth/2+config.inGraphDataPaddingX ;}
else if(config.inGraphDataXPosition==3) { xPos=barOffset+barWidth+config.inGraphDataPaddingX;}
Avoid deeply nested control flow statements. Open
Open
if (typeof (data.labels[j]) == "string") lgtxt2 = data.labels[j].trim();
else lgtxt2 = "";
Avoid deeply nested control flow statements. Open
Open
if(config.inGraphDataYPosition==1) { yPos=barOffset + barWidth - config.inGraphDataPaddingY; }
else if(config.inGraphDataYPosition==2) { yPos=barOffset + barWidth/2- config.inGraphDataPaddingY; }
else if(config.inGraphDataYPosition==3) { yPos=barOffset- config.inGraphDataPaddingY; }
Avoid deeply nested control flow statements. Open
Open
if((posAngle> Math.PI && posAngle<2*Math.PI) || (posAngle< 0 && posAngle>-Math.PI) || (posAngle< -2*Math.PI && posAngle>-3*Math.PI))ctx.textBaseline = "top";
else ctx.textBaseline = "bottom";
Avoid deeply nested control flow statements. Open
Open
if (config.datasetFill) {
ctx.lineWidth = 1;
ctx.moveTo(xpos , ypos);
ctx.lineTo(xpos + config.legendBlockSize, ypos);
ctx.lineTo(xpos + config.legendBlockSize, ypos - config.legendFontSize );
Method import_user_from_ldap_mail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def import_user_from_ldap_mail(ldap_cn, email, ldap_server)
login_filter = Net::LDAP::Filter.eq ldap_server.email_attribute, "#{email}"
object_filter = Net::LDAP::Filter.eq 'objectClass', '*'
#is_an_automatic_account_activation? ? status = 'active' : 'pending'
- 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
estimation_value_id = new_estimation_value.nil? ? nil : new_estimation_value.id
Avoid deeply nested control flow statements. Open
Open
else if(config.inGraphDataAlign=="to-center"){
if(config.inGraphDataRotate=="inRadiusAxis" || posAngle< Math.PI/2 || (posAngle > 3*Math.PI/2 && posAngle < 5*Math.PI/2))ctx.textAlign = "right";
else ctx.textAlign="left";
}
else ctx.textAlign = config.inGraphDataAlign;
Avoid deeply nested control flow statements. Open
Open
if((posAngle> Math.PI && posAngle<2*Math.PI) || (posAngle< 0 && posAngle>-Math.PI) || (posAngle< -2*Math.PI && posAngle>-3*Math.PI))ctx.textBaseline = "top";
else ctx.textBaseline = "bottom";