Maingron/MaingronZelda

View on GitHub

Showing 130 of 130 total issues

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

    if (data.keypress.up && data.runner.cango.up) {

        data.runner.position.top--;

        setTimeout(function () {
Severity: Major
Found in scripts.js and 1 other location - About 5 days to fix
scripts.js on lines 662..709

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 854.

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

    } else if (data.keypress.down && data.runner.cango.down) {

        data.runner.position.top++;

        setTimeout(function () {
Severity: Major
Found in scripts.js and 1 other location - About 5 days to fix
scripts.js on lines 626..709

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 854.

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

function loadLevel(level = pData.level) {

    pData.level = level;
    init();
    data.runner.inmenu = 0;
Severity: Major
Found in levels.js - About 5 days to fix

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

                } else if (data.runner.position.top == data.enemys[data.temp.iOfEnemyTick][2]) { //If left or right from slicer
    
                    if (data.runner.position.left > data.enemys[data.temp.iOfEnemyTick][1] && data.runner.position.left < data.enemys[data.temp.iOfEnemyTick][5]) {
                        data.temp.iOfSlicer = 0;
    
    
    Severity: Major
    Found in scripts.js and 1 other location - About 4 days to fix
    scripts.js on lines 826..877

    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 811.

    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

                } else if (data.runner.position.left == data.enemys[data.temp.iOfEnemyTick][1]) { //If above or below slicer
    
    
                    if (data.runner.position.top > data.enemys[data.temp.iOfEnemyTick][2] && data.runner.position.top < data.enemys[data.temp.iOfEnemyTick][6]) {
                        data.temp.iOfSlicer = 0;
    Severity: Major
    Found in scripts.js and 1 other location - About 4 days to fix
    scripts.js on lines 852..877

    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 811.

    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.keypress.left && data.runner.cango.left) {
    
            data.runner.position.left--;
    
            setTimeout(function () {
    Severity: Major
    Found in scripts.js and 1 other location - About 4 days to fix
    scripts.js on lines 750..792

    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 790.

    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

        } else if (data.keypress.right && data.runner.cango.right) {
    
            data.runner.position.left++;
    
            setTimeout(function () {
    Severity: Major
    Found in scripts.js and 1 other location - About 4 days to fix
    scripts.js on lines 712..792

    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 790.

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

    function doEnemyTick() {
        data.temp.slicernr = 0;
    
        for (data.temp.iOfEnemyTick = 0; data.enemys.length > data.temp.iOfEnemyTick; data.temp.iOfEnemyTick++) {
            if (data.enemys[data.temp.iOfEnemyTick][0] == "spikes") {
    Severity: Minor
    Found in scripts.js - About 2 days 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 levels.js has 1073 lines of code (exceeds 250 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: Major
    Found in levels.js - About 2 days to fix

      Function loadLevel has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
      Open

      function loadLevel(level = pData.level) {
      
          pData.level = level;
          init();
          data.runner.inmenu = 0;
      Severity: Minor
      Found in levels.js - About 2 days 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 scripts.js has 920 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var pData = { // pData means permanent Data like saves
          "runner": {},
          "leveldata": {}
      };
      
      
      Severity: Major
      Found in scripts.js - About 2 days to fix

        Function init2 has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
        Open

        function init2() {
            for (data.iOfInit2 = 0; data.walls.length > data.iOfInit2; data.iOfInit2++) {
                data.temp.setWalls = [];
                data.temp.setWalls[data.iOfInit2] = data.walls[data.iOfInit2].split(",");
                summonElement("wall", objects.field, +data.temp.setWalls[data.iOfInit2][1], +data.temp.setWalls[data.iOfInit2][2]);
        Severity: Minor
        Found in scripts.js - About 1 day 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

                            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 and 1 other location - About 1 day to fix
        scripts.js on lines 159..167

        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 296.

        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

                            } else if (data.walls[data.temp.iOfInit2_2][1] == data.temp.setEnemys[data.iOfInit2][1]) {
                                if (data.walls[data.temp.iOfInit2_2][2] > data.temp.setEnemys[data.iOfInit2][2] && data.walls[data.temp.iOfInit2_2][2] < data.temp.setEnemys[data.iOfInit2][6]) {
                                    data.temp.setEnemys[data.iOfInit2][6] = data.walls[data.temp.iOfInit2_2][2];
                                }
        
        
        Severity: Major
        Found in scripts.js and 1 other location - About 1 day to fix
        scripts.js on lines 151..167

        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 296.

        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.keypress.down && data.keypress.right) {
                    if (data.runner.position.left == data.walls[data.temp.iOfTick][1] - 1 && data.runner.position.top == data.walls[data.temp.iOfTick][2] - 1) {
                        data.runner.cango.right = 0;
                    }
                } else if (data.keypress.down && data.keypress.left) {
        Severity: Major
        Found in scripts.js and 1 other location - About 1 day to fix
        scripts.js on lines 496..504

        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 275.

        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.keypress.up && data.keypress.right) {
                    if (data.runner.position.left == data.walls[data.temp.iOfTick][1] - 1 && data.runner.position.top == data.walls[data.temp.iOfTick][2] + 1) {
                        data.runner.cango.right = 0;
                    }
                } else if (data.keypress.up && data.keypress.left) {
        Severity: Major
        Found in scripts.js and 1 other location - About 1 day to fix
        scripts.js on lines 486..494

        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 275.

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

        function doTick() {
        
            if (!data.runner.inmenu) {
                data.runner.oldposition.top = data.runner.position.top;
                data.runner.oldposition.left = data.runner.position.left;
        Severity: Minor
        Found in scripts.js - About 1 day 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

        addEventListener("focus",function() {
            objects.field.style.top = objects.gameframe.offsetHeight / 2 - data.runner.position.top * data.field.oneHeight - data.field.oneHeight * .5 + "px";
            objects.field.style.left = objects.gameframe.offsetWidth / 2 - data.runner.position.left * data.field.oneWidth - data.field.oneWidth * .5 + "px";
        });
        Severity: Major
        Found in scripts2.js and 1 other location - About 6 hrs to fix
        scripts2.js on lines 1..4

        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 166.

        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

        window.addEventListener("resize",function() {
            objects.field.style.top = objects.gameframe.offsetHeight / 2 - data.runner.position.top * data.field.oneHeight - data.field.oneHeight * .5 + "px";
            objects.field.style.left = objects.gameframe.offsetWidth / 2 - data.runner.position.left * data.field.oneWidth - data.field.oneWidth * .5 + "px";
        });
        Severity: Major
        Found in scripts2.js and 1 other location - About 6 hrs to fix
        scripts2.js on lines 6..9

        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 166.

        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 4 locations. Consider refactoring.
        Open

                    } else if (data.enemys[data.forenemys[data.temp.iOfEnemyTick]][9] == "up") {
                        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 and 3 other locations - About 5 hrs to fix
        scripts.js on lines 890..914
        scripts.js on lines 902..914
        scripts.js on lines 908..914

        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 149.

        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