Showing 86 of 120 total issues
Function drawBgImage
has 7 arguments (exceeds 5 allowed). Consider refactoring. Open
Open
function drawBgImage(drawingContext, bgimage, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
Avoid deeply nested control flow statements. Open
Open
if(value != null) break;
Avoid deeply nested control flow statements. Open
Open
if(pv !== ret.pv) {
this[key] = ret.rv;
return this[key];
}
Avoid deeply nested control flow statements. Open
Open
if(evt.terminated && type !== 'mousemove') {
break;
}
Consider simplifying this complex logical expression. Open
Open
if(key === 'fontSize'
|| key === 'fontFamily'
|| key === 'fontStyle'
|| key === 'fontVariant'
|| key === 'fontWeight') {
Consider simplifying this complex logical expression. Open
Open
if(bgimage && bgimage.display !== 'none' || borderRadius && (this.nodeType !== 'sprite' || this.textures && this.textures.length)) {
drawingContext.clip();
}
Consider simplifying this complex logical expression. Open
Open
if(typeof document !== 'undefined'
&& document.documentElement
&& document.documentElement.contains
&& target.layer
&& target.layer.canvas
Consider simplifying this complex logical expression. Open
Open
if(layerX == null && layerY == null
|| layerX >= 0 && layerY >= 0 && layerX < width && layerY < height) {
return true;
}
Consider simplifying this complex logical expression. Open
Open
if(cache || reflow || relayout || quiet || value || extra) {
throw new Error('Cannot apply state to composit attribute.');
}
Consider simplifying this complex logical expression. Open
Open
if(!this.cacheContext || borderWidth || borderRadius || bgcolor || bgimage && bgimage.display !== 'none') {
let [x, y, w, h, r] = [borderWidth, borderWidth,
clientWidth, clientHeight,
borderRadius];
Function drawEllipseBorder
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
Open
function drawEllipseBorder(ctx, x, y, w, h, pos = 'leftTop') {
Function drawDot9Image
has a Cognitive Complexity of 27 (exceeds 25 allowed). Consider refactoring. Open
Open
function drawDot9Image(drawingContext, image, clip9, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
const w = image.width,
h = image.height;
const [top, right, bottom, left] = clip9 || [16, 16, 16, 16];
- 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
Open
return this[_attr].attrs;
Avoid too many return
statements within this function. Open
Open
return false;
Avoid too many return
statements within this function. Open
Open
return this[_data];
Avoid too many return
statements within this function. Open
Open
return [...val, 0, 0, 0, 0, 0, 0, 0, 0].slice(0, 8);
Avoid too many return
statements within this function. Open
Open
return this[_attr][props];
Avoid too many return
statements within this function. Open
Open
return true;
Avoid too many return
statements within this function. Open
Open
return ret.rv;
Avoid too many return
statements within this function. Open
Open
return this;