Showing 7 of 53 total issues
Function draw
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function(x, y) {
ctx.fillStyle = "black";
ctx.fillRect(x, y, 76, -40);
ctx.beginPath();
Function draw
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function() {
/* body and color */
ctx.beginPath();
Function draw
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function(x, y) {
let numberSpikes = 20;
let sawRadius = 80;
let sawHeight = y - 60 * (3 + Math.sin(time / 70 / 2 * Math.PI));
Function draw
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
draw: function(x, y) {
ctx.fillStyle = "black";
ctx.fillRect(x, y, 76, -40);
ctx.beginPath();
- 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 drawObstacles
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
let drawObstacles = function() {
let obs_listPosition = 0;
/* Calculate the offset of the obstacles. This is the amount by
* which we shift the obstacles to the left. */
- 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 drawStats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
let drawStats = function() {
ctx.fillStyle = "white";
ctx.font = '20px monospace';
ctx.fillText("time = " + time, 10, 20);
ctx.fillText("hero position = [" + hero.x.toFixed(0) +
- 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 drawHero
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
let drawHero = function() {
if (debugMode) {
hero.x = mousePosition.x;
hero.y = mousePosition.y;
} else {
- 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"