video-game-coding-club/geometry-smash

View on GitHub

Showing 52 of 53 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

let toxicSign = {
draw: function(x, y) {
drawSignOutline(x, y);
 
ctx.beginPath();
Severity: Major
Found in main.js and 1 other location - About 5 hrs to fix
main.js on lines 186..204

Similar blocks of code found in 2 locations. Consider refactoring.
Open

let electricSign = {
draw: function(x, y) {
drawSignOutline(x, y);
 
ctx.beginPath();
Severity: Major
Found in main.js and 1 other location - About 5 hrs to fix
main.js on lines 167..184

Similar blocks of code found in 2 locations. Consider refactoring.
Open

let keyPress = function(event) {
console.log("pressed key '" + event.key + "', code " + event.code);
for (let i = 0; i < keyPressListeners.length; i++) {
keyPressListeners[i](event);
}
Severity: Major
Found in main.js and 1 other location - About 2 hrs to fix
main.js on lines 859..864

Similar blocks of code found in 2 locations. Consider refactoring.
Open

let keyRelease = function(event) {
console.log("released key '" + event.key + "', code " + event.code);
for (let i = 0; i < keyReleaseListeners.length; i++) {
keyReleaseListeners[i](event);
}
Severity: Major
Found in main.js and 1 other location - About 2 hrs to fix
main.js on lines 852..857

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();
Severity: Minor
Found in main.js - About 2 hrs to fix

    Function draw has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    draw: function() {
     
    /* body and color */
     
    ctx.beginPath();
    Severity: Minor
    Found in main.js - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let powerkeyReleasedMoveHero = function(event) {
      if (event.code === "ControlLeft" || event.code == "ControlRight") {
      console.log("turning hero booster off");
      hero.is_boosting = false;
      }
      Severity: Major
      Found in main.js and 1 other location - About 1 hr to fix
      main.js on lines 720..725

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let powerkeyPressedMoveHero = function(event) {
      if (event.code === "ControlLeft" || event.code == "ControlRight") {
      console.log("boosting hero");
      hero.is_boosting = true;
      }
      Severity: Major
      Found in main.js and 1 other location - About 1 hr to fix
      main.js on lines 784..789

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let mouseClick = function(event) {
      console.log("mouse clicked");
      for (let i = 0; i < mouseClickedListeners.length; i++) {
      mouseClickedListeners[i](event);
      }
      Severity: Major
      Found in main.js and 1 other location - About 1 hr to fix
      main.js on lines 845..850

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let mouseMove = function(event) {
      console.log("mouse moved");
      for (let i = 0; i < mouseMoveListeners.length; i++) {
      mouseMoveListeners[i](event);
      }
      Severity: Major
      Found in main.js and 1 other location - About 1 hr to fix
      main.js on lines 838..843

      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));
       
       
      Severity: Minor
      Found in main.js - About 1 hr to fix

        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();
        Severity: Minor
        Found in main.js - About 1 hr to fix

        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. */
        Severity: Minor
        Found in main.js - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        let upperCaseGKeyPressed = function(event) {
        if (event.code === "KeyG" && event.key === "G") {
        hero.g = hero.g - 0.1;
        }
        };
        Severity: Major
        Found in main.js and 1 other location - About 1 hr to fix
        main.js on lines 803..807

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        let lowerCaseGKeyPressed = function(event) {
        if (event.code === "KeyG" && event.key === "g") {
        hero.g = hero.g + 0.1;
        }
        };
        Severity: Major
        Found in main.js and 1 other location - About 1 hr to fix
        main.js on lines 797..801

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        let stepKeyPressed = function(event) {
        if (event.code === "KeyS" && event.key === "s") {
        if (debugMode) {
        time++;
        }
        Severity: Minor
        Found in main.js and 1 other location - About 50 mins to fix
        main.js on lines 776..782

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        let reverseStepKeyPressed = function(event) {
        if (event.code === "KeyS" && event.key === "S") {
        if (debugMode) {
        time--;
        }
        Severity: Minor
        Found in main.js and 1 other location - About 50 mins to fix
        main.js on lines 768..774

        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) +
        Severity: Minor
        Found in main.js - About 35 mins to fix

        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 {
        Severity: Minor
        Found in main.js - About 35 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        let restartKeyPressed = function(event) {
        if (event.code === "KeyR" && event.key === "r") {
        resetGame();
        }
        };
        Severity: Minor
        Found in main.js and 1 other location - About 35 mins to fix
        main.js on lines 791..795
        Severity
        Category
        Status
        Source
        Language