Maingron/MaingronZelda

View on GitHub

Showing 41 of 130 total issues

Function randomizeGraphics has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function randomizeGraphics() {

    // for(data.temp.iOfRandom1 = 0; document.getElementsByClassName("path1").length > data.temp.iOfRandom1; data.temp.iOfRandom1++) {
    //     randomizeGraphicsSub1(document.getElementsByClassName("path1"));
    // }
Severity: Minor
Found in scripts.js - About 1 hr to fix

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 randomizeGraphics has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function randomizeGraphics() {

    // for(data.temp.iOfRandom1 = 0; document.getElementsByClassName("path1").length > data.temp.iOfRandom1; data.temp.iOfRandom1++) {
    //     randomizeGraphicsSub1(document.getElementsByClassName("path1"));
    // }
Severity: Minor
Found in scripts.js - About 1 hr to fix

    Function doMove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    function doMove() {
    
        if (data.runner.position.top <= 0) {
            data.runner.cango.up = !1;
        } else if (data.runner.position.top >= data.field.height - 1) {
    Severity: Minor
    Found in scripts.js - About 1 hr to fix

    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 saveState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    function saveState(name, content) {
        if (content == "t") {
            if (loadState(name) == 1) {
                content = 0;
            } else {
    Severity: Minor
    Found in scripts.js - About 55 mins to fix

    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 createRoom has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function createRoom(x,y, type, buildTop = 1, buildRight = 1, buildBottom = 1, buildLeft = 1) {
    Severity: Major
    Found in levels.js - About 50 mins to fix

      Avoid deeply nested control flow statements.
      Open

          } else if (level.indexOf("006") >= 0) { //Level 6 - Dungeon 1
              summonElement("runner", objects.field, 100, 198);
              data.runner.position.top = 198;
              data.runner.position.left = 100;
      
      
      Severity: Major
      Found in levels.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if (pData.leveldata[data.temp.triggerKeycollect[0]].keys[data.temp.triggerKeycollect[1]] == 0) {
                                pData.leveldata[data.temp.triggerKeycollect[0]].keys[0]++;
                            }
        Severity: Major
        Found in scripts.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if(loadState("colormode") != "1") {
                          summonElement("button1-1", objects.field, 4, 1);
                      } else {
                          summonElement("button1-2", objects.field, 4, 1);
                      }
          Severity: Major
          Found in levels.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    } else if (level == "004-3") { // Pause menu
                        loadLevel("004");
            
                    } else if (level == "004-4") { // Level Selection
                        summonElement("textbox", objects.field, 0, 0, lang.back);
            Severity: Major
            Found in levels.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (data.runner.position.top == data.enemys[data.temp.iOfEnemyTick][2] && data.runner.position.left == data.enemys[data.temp.iOfEnemyTick][1]) {
                              doHurt(1);
                              data.runner.position.top = +data.runner.oldotherposition.top;
                              data.runner.position.left = +data.runner.oldotherposition.left;
                          } else if (data.runner.position.left == data.enemys[data.temp.iOfEnemyTick][1]) { //If above or below slicer
              Severity: Major
              Found in scripts.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if(loadState("music") != "false") {
                                summonElement("button1-2", objects.field, 4, 2);
                            } else {
                                summonElement("button1-1", objects.field, 4, 2);
                            }
                Severity: Major
                Found in levels.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                              } else if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] == "right") {
                                  if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][1] < +data.enemys[data.forenemys[data.temp.iOfEnemyTick]][5] - 1) {
                                      data.enemys[data.forenemys[data.temp.iOfEnemyTick]][1]++;
                                  } else {
                                      data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] = "cooldown12";
                  Severity: Major
                  Found in scripts.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    for (var i=0; i <= 4; i++) { // Stop player from moving
                                        setTimeout(function () {
                                            data.runner.cango = {};
                                        }, data.ticktime * i);
                                    }
                    Severity: Major
                    Found in scripts.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              for (data.temp.iOfLG = 1; data.temp.iOfLG < 11; data.temp.iOfLG++) {
                                  data.walls.push("type1-8,0," + data.temp.iOfLG);
                                  data.walls.push("type1-4,29," + data.temp.iOfLG);
                      
                              }
                      Severity: Major
                      Found in levels.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                for (data.temp.iOfLG = 1; data.temp.iOfLG < 29; data.temp.iOfLG++) {
                                    data.walls.push("type1-2," + data.temp.iOfLG + ",0");
                                    if (data.temp.iOfLG != 15) {
                                        data.walls.push("type1-6," + data.temp.iOfLG + ",11");
                                    }
                        Severity: Major
                        Found in levels.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if (data.walls[data.temp.iOfInit2_2][2] == data.temp.setEnemys[data.iOfInit2][2]) {
                                                  if (data.walls[data.temp.iOfInit2_2][1] > data.temp.setEnemys[data.iOfInit2][1] && data.walls[data.temp.iOfInit2_2][1] < data.temp.setEnemys[data.iOfInit2][5]) {
                                                      data.temp.setEnemys[data.iOfInit2][5] = data.walls[data.temp.iOfInit2_2][1];
                                                  }
                          
                          
                          Severity: Major
                          Found in scripts.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][2] > +data.enemys[data.forenemys[data.temp.iOfEnemyTick]][4] + 1) {
                                                data.enemys[data.forenemys[data.temp.iOfEnemyTick]][2]--;
                                            } else {
                                                data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] = "cooldown12";
                                            }
                            Severity: Major
                            Found in scripts.js - About 45 mins to fix

                              Function summonElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function summonElement(classname, childof, x = 0, y = 0, triggerdo) {
                              Severity: Minor
                              Found in scripts.js - About 35 mins to fix

                                Function summonElementKey has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function summonElementKey(classname, levelnr, keynr, x, y) { // Spawn a key
                                Severity: Minor
                                Found in scripts.js - About 35 mins to fix

                                  Function doTick2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function doTick2() {
                                      data.visibleTilesY = window.innerHeight / (10 * 9) / 2 + 3; // CSS Tile height x Zoom level + Preprocessing
                                      data.visibleTilesX = window.innerWidth / (10 * 9) / 2 + 3; // CSS Tile height x Zoom level + Preprocessing
                                  
                                      for (var i = 0; data.allthings.length > i; i++) {
                                  Severity: Minor
                                  Found in scripts.js - About 35 mins to fix

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language