Showing 86 of 120 total issues
Function attr
has a Cognitive Complexity of 29 (exceeds 25 allowed). Consider refactoring. Open
attr(props, val) {
const setVal = (key, value) => {
if(!(key in this[_attr])) {
createAttribute(this[_attr], key);
}
- 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 drawBgImage
has a Cognitive Complexity of 29 (exceeds 25 allowed). Consider refactoring. Open
function drawBgImage(drawingContext, bgimage, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
const {image, display, clip9} = bgimage;
if(display === '.9') {
drawDot9Image(drawingContext, image, clip9, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight);
- 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 drawDot9Image
has 8 arguments (exceeds 5 allowed). Consider refactoring. Open
function drawDot9Image(drawingContext, image, clip9, borderWidth, offsetWidth, offsetHeight, clientWidth, clientHeight) {
Function enter
has a Cognitive Complexity of 28 (exceeds 25 allowed). Consider refactoring. Open
enter(toState) {
const states = this.attr('states');
let ret;
if(states && (states.beforeEnter || states.afterEnter)) {
const deferred = this.resolveStates(['beforeEnter', 'afterEnter'], (_states) => {
- 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
if(subject[_attrAbsolute]) {
return pv * ret.v;
}
Avoid deeply nested control flow statements. Open
if(name === 'class') {
ret = `.${value}`;
} else {
ret = `[${name}~="${value}"]`;
}
Avoid deeply nested control flow statements. Open
} else if(action === 'any') {
ret = `[${name}*="${value}"]`;
} else if(action === 'hyphen') {
ret = `[${name}|="${value}"]`;
}
Avoid deeply nested control flow statements. Open
if(node.querySelectorAll) {
const nodes = node.querySelectorAll('*');
nodes.forEach(child => child.restyle());
}
Avoid deeply nested control flow statements. Open
if(pv !== ret.pv) {
this[key] = ret.rv;
return this[key];
}
Avoid deeply nested control flow statements. Open
if(subject[_attrAbsolute]) {
return pv * ret.v;
}
Avoid deeply nested control flow statements. Open
if(d <= w) {
ret = [x, y + h, x + d, y];
} else {
d = w / tan;
ret = [x, y + h, x + w, y + h - d];
Avoid deeply nested control flow statements. Open
if(touch.identifier === identifier) {
const targets = this.layer.touchedTargets[identifier];
if(targets) {
targets.forEach((target) => {
if(target !== this && target.layer === this) {
Avoid deeply nested control flow statements. Open
for(let i = 0; i < sprites.length; i++) {
const sprite = sprites[i];
const hit = sprite.dispatchEvent(type, evt, collisionState, swallow, useCapturePhase);
if(hit) {
if(evt.targetSprites) {
Avoid deeply nested control flow statements. Open
} else if(key === 'transitionDelay') {
transition = transition || {};
transition.delay = value;
} else if(key === 'transitionDuration') {
transition = transition || {};
Avoid deeply nested control flow statements. Open
while(ch > borderWidth) {
drawingContext.drawImage(image, clientWidth - cw, clientHeight - ch, w, h);
ch -= h;
}
Avoid deeply nested control flow statements. Open
if(unit === 'vmax') {
size *= Math.max(width, height) / 100;
} else {
size *= Math.min(width, height) / 100;
}
Avoid deeply nested control flow statements. Open
if(/Color$/.test(key)) {
attrs.borderColor = value;
} else if(/Style$/.test(key)) {
attrs.borderStyle = value;
} else if(/Width$/.test(key)) {
Avoid deeply nested control flow statements. Open
if(hit) {
if(evt.targetSprites) {
targetSprites.push(...evt.targetSprites);
delete evt.targetSprites;
}
Avoid deeply nested control flow statements. Open
if(layer) {
if(relative === 'rw') {
pv = layer.resolution[0];
} else if(relative === 'rh') {
pv = layer.resolution[1];
Avoid deeply nested control flow statements. Open
if(!evt.target) evt.target = this.getTargetFromXY(evt.parentX, evt.parentY);