Maingron/MaingronZelda

View on GitHub

Showing 130 of 130 total issues

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

        if (data.runner.position.top != data.runner.oldposition.top) {
            data.runner.oldotherposition.top = +data.runner.oldposition.top;
            data.runner.oldotherposition.left = +data.runner.oldposition.left;
        }
Severity: Major
Found in scripts.js and 1 other location - About 3 hrs to fix
scripts.js on lines 572..575

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    if (data.runner.position.top <= 0) {
        data.runner.cango.up = !1;
    } else if (data.runner.position.top >= data.field.height - 1) {
        data.runner.cango.down = !1;
    }
Severity: Major
Found in scripts.js and 1 other location - About 3 hrs to fix
scripts.js on lines 619..623

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    if (data.runner.position.left <= 0) {
        data.runner.cango.left = !1;
    } else if (data.runner.position.left >= data.field.width - 1) {
        data.runner.cango.right = !1;
    }
Severity: Major
Found in scripts.js and 1 other location - About 3 hrs to fix
scripts.js on lines 613..617

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function doInMenuTick has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function doInMenuTick() {

    if (data.runner.inmenu == true) {
        data.temp.menuGoBack = 0;
        data.runner.cango.down = 0;
Severity: Minor
Found in scripts.js - About 2 hrs 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

File midiplayer.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var midiPlayer = {};


function extend(a, b){
    for(var key in b)
Severity: Minor
Found in sound/midiplayer.js - About 2 hrs to fix

    Function init has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function init() {
        if (objects.field) {
            objects.field.innerHTML = "";
            objects.field.outerHTML = "";
        }
    Severity: Major
    Found in scripts.js - About 2 hrs to fix

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

              for (data.temp.iOfLG = 36; data.temp.iOfLG >= 32; data.temp.iOfLG--) {
                  data.walls.push("type2-2," + data.temp.iOfLG + ",34");
              }
      Severity: Major
      Found in levels.js and 2 other locations - About 2 hrs to fix
      levels.js on lines 103..105
      levels.js on lines 410..412

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              for (data.temp.iOfLG = 58; data.temp.iOfLG <= 65; data.temp.iOfLG++) {
                  data.walls.push("type2-2," + data.temp.iOfLG + ",34");
              }
      Severity: Major
      Found in levels.js and 2 other locations - About 2 hrs to fix
      levels.js on lines 103..105
      levels.js on lines 343..345

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if(buildBottom == 1) {
                  data.walls.push("type3-10, "+(x+8)+","+(y + 10));
                  data.walls.push("type3-9, "+(x+10)+","+(y + 10));
                  // summonElement("floor3-1", "", (x+9), (y + 10));
              }
      Severity: Major
      Found in levels.js and 1 other location - About 2 hrs to fix
      levels.js on lines 53..57

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if(buildRight == 1) {
                  data.walls.push("type3-12, "+(x+18)+","+(y+4));
                  data.walls.push("type3-9, "+(x+18)+","+(y+6));
                  // summonElement("floor3-1", "", (x+18), (y + 5));
              }
      Severity: Major
      Found in levels.js and 1 other location - About 2 hrs to fix
      levels.js on lines 67..71

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              for (data.temp.iOfLG = 1; data.temp.iOfLG < 17; data.temp.iOfLG++) {
                  data.walls.push("type1-2," + data.temp.iOfLG + ",0");
              }
      Severity: Major
      Found in levels.js and 2 other locations - About 2 hrs to fix
      levels.js on lines 343..345
      levels.js on lines 410..412

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if (data.temp.randomnumber1 == 1) {
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.add("floor3-2");
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.remove("floor3-1");
              } else if (data.temp.randomnumber1 == 2) {
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.add("floor3-3");
      Severity: Major
      Found in scripts.js and 2 other locations - About 1 hr to fix
      scripts.js on lines 1123..1129
      scripts.js on lines 1126..1129

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 74.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              } else if (data.temp.randomnumber1 == 2) {
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.add("floor3-3");
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.remove("floor3-1");
              } else if (data.temp.randomnumber1 == 3) {
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.add("floor3-4");
      Severity: Major
      Found in scripts.js and 2 other locations - About 1 hr to fix
      scripts.js on lines 1120..1129
      scripts.js on lines 1126..1129

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 74.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              } else if (data.temp.randomnumber1 == 3) {
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.add("floor3-4");
                  document.getElementsByClassName("floor3-1")[data.temp.iOfRandom1].classList.remove("floor3-1");
              }
      Severity: Major
      Found in scripts.js and 2 other locations - About 1 hr to fix
      scripts.js on lines 1120..1129
      scripts.js on lines 1123..1129

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 74.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function destroyElement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function destroyElement(x, y, type) {
          for (var i = 0; i < data.allthings.length; i++) {
              if (data.allthings[i][0] == "trigger") {
                  console.log(data.allthings[i]);
              }
      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

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

              for (data.temp.iOfLG = 1; data.temp.iOfLG < 11; data.temp.iOfLG++) {
                  data.walls.push("type1-8,0," + data.temp.iOfLG);
              }
      Severity: Major
      Found in levels.js and 1 other location - About 1 hr to fix
      levels.js on lines 117..119

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 72.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              for (data.temp.iOfLG = 1; data.temp.iOfLG < 11; data.temp.iOfLG++) {
                  data.walls.push("type1-4,17," + data.temp.iOfLG);
              }
      Severity: Major
      Found in levels.js and 1 other location - About 1 hr to fix
      levels.js on lines 113..115

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 72.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function createRoom has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createRoom(x,y, type, buildTop = 1, buildRight = 1, buildBottom = 1, buildLeft = 1) {
          // Build** == 0: Don't spawn walls on that side
          // Build** == 1: Spawn walls on that side + leave space for door
          // TODO Build** == 2: Spawn walls on that side and block walls
          // TODO Build** == 3: Spawn fully wall-filled room
      Severity: Minor
      Found in levels.js - About 1 hr to fix

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

                    document.getElementsByClassName("slicer")[data.temp.slicernr].style.top = data.enemys[data.temp.iOfEnemyTick][2] * data.field.oneHeight + "px";
        Severity: Major
        Found in scripts.js and 1 other location - About 1 hr to fix
        scripts.js on lines 881..881

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 71.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                    document.getElementsByClassName("slicer")[data.temp.slicernr].style.left = data.enemys[data.temp.iOfEnemyTick][1] * data.field.oneWidth + "px";
        Severity: Major
        Found in scripts.js and 1 other location - About 1 hr to fix
        scripts.js on lines 882..882

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 71.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language