Showing 70 of 724 total issues
Function ioGenerator
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ioGenerator: (random) => {
const numbers = [0, 0, 0];
const primes = [2];
for (let i = 3; i < 256; i++) {
let flag = 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
if (this.state.selectStart !== null && this.state.selectEnd !== null) {
this.setState({
moveStatus: 'move',
});
}
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(config) {
super();
this.height = config.height;
this.width = config.width;
- 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
} else if (event.type === 'pan') {
if (this.state.moveStart !== null) {
this.setState({
moveEnd: {x: blockX, y: blockY},
});
Function componentDidUpdate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(prevProps) {
if (prevProps.isMovingMode && !this.props.isMovingMode) {
this.resetMoveState();
}
- 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 (this.isSelectedBlock(startBlockX, startBlockY)) {
this.setState({
moveStart: {x: startBlockX, y: startBlockY},
moveEnd: {x: startBlockX, y: startBlockY},
});
Function componentDidUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(prevProps) {
if (!prevProps.isAnimating && this.props.isAnimating) {
this.handleStartAnimation();
}
- 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 log
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports.log = (a, b) => {
if (a <= 0 || a === 1 || b <= 0 || (a === Infinity && b === Infinity)) {
return NaN;
}
- 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
return {pass: false, message: 'positions of blocks are not unique'};
Avoid too many return
statements within this function. Open
return `translate(${BLOCK_SIZE / 2}, ${BLOCK_SIZE / 2})`;
Avoid too many return
statements within this function. Open
return {pass: false, message: 'used blocks are not matching to the stage'};
Avoid too many return
statements within this function. Open
return {pass: false, message: 'used blocks are not matching to the stage'};
Avoid too many return
statements within this function. Open
return {y: `-=${BLOCK_SIZE / 2}`};
Avoid too many return
statements within this function. Open
return {x: `-=${BLOCK_SIZE / 2}`};
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return `y position of block ${index} exceeds the board size`;
Avoid too many return
statements within this function. Open
return {y: `+=${BLOCK_SIZE / 2}`};
Avoid too many return
statements within this function. Open
return {pass: false, message: error};
Avoid too many return
statements within this function. Open
return `type of block ${index} is unknown`;
Avoid too many return
statements within this function. Open
return {x: `+=${BLOCK_SIZE / 2}`};