fassetar/penguins-rising

View on GitHub

Showing 27 of 27 total issues

Function snowStorm has a Cognitive Complexity of 254 (exceeds 5 allowed). Consider refactoring.
Open

var snowStorm = (function(window, document) {

  // --- common properties ---

  this.autoStart = true;          // Whether the snow should start automatically or not.
Severity: Minor
Found in src/js/snow.js - About 5 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

Function snowStorm has 536 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var snowStorm = (function(window, document) {

  // --- common properties ---

  this.autoStart = true;          // Whether the snow should start automatically or not.
Severity: Major
Found in src/js/snow.js - About 2 days to fix

    File snow.js has 538 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /** @license
     * DHTML Snowstorm! JavaScript-based snow for web pages
     * Making it snow on the internets since 2003. You're welcome.
     * -----------------------------------------------------------
     * Version 1.44.20131208 (Previous rev: 1.44.20131125)
    Severity: Major
    Found in src/js/snow.js - About 1 day to fix

      Function SnowFlake has 150 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.SnowFlake = function(type,x,y) {
          var s = this;
          this.type = type;
          this.x = x||parseInt(rnd(screenX-20),10);
          this.y = (!isNaN(y)?y:-rnd(screenY)-12);
      Severity: Major
      Found in src/js/snow.js - About 6 hrs to fix

        File game.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use script';
        
        var img = new Image();
        img.src = "http://fassetar.github.io/penguins-rising/content/img/characters.png";
        var canvas = document.getElementById("window");
        Severity: Minor
        Found in src/js/game.js - About 4 hrs to fix

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

              if (storm.freezeOnBlur) {
                if (isIE) {
                  storm.events.add(document,'focusout',storm.freeze);
                  storm.events.add(document,'focusin',storm.resume);
                } else {
          Severity: Major
          Found in src/js/snow.js and 1 other location - About 3 hrs to fix
          src/js/snow.js on lines 335..343

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

          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 (storm.freezeOnBlur) {
                if (isIE) {
                  storm.events.remove(document,'focusout',storm.freeze);
                  storm.events.remove(document,'focusin',storm.resume);
                } else {
          Severity: Major
          Found in src/js/snow.js and 1 other location - About 3 hrs to fix
          src/js/snow.js on lines 584..592

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

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

          module.exports = function ( grunt ) {
          
              pkg: grunt.file.readJSON('package.json'),
              require( 'matchdep' ).filterDev('grunt-*').forEach( grunt.loadNpmTasks );
          
          
          Severity: Major
          Found in Gruntfile.js - About 3 hrs to fix

            Function Enemy has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Enemy(I) {
              I = I || {};
              I.active = true;
              I.age = Math.floor(Math.random() * 128);
              I.x = Math.random() * canvas.width;
            Severity: Major
            Found in src/js/game.js - About 3 hrs to fix

              Function Enemy has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              function Enemy(I) {
                I = I || {};
                I.active = true;
                I.age = Math.floor(Math.random() * 128);
                I.x = Math.random() * canvas.width;
              Severity: Minor
              Found in src/js/game.js - About 3 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

              Function update has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                update: function() { //UPDATE METHOD
                  if ((TheTrulyDead.length > game.LvlEnemies) && (enemies.length === 0)) {
                    game.Lvlcomplete = true;
                    game.LvlEnemies += 5;
                    game.Lvl += 1;
              Severity: Minor
              Found in src/js/game.js - About 1 hr to fix

                Function move has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    this.move = function() {
                      var vX = s.vX*windOffset, yDiff;
                      s.x += vX;
                      s.y += (s.vY*s.vAmp);
                      if (s.x >= screenX || screenX-s.x < storm.flakeWidth) { // X-axis scroll check
                Severity: Minor
                Found in src/js/snow.js - About 1 hr to fix

                  Function events has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    this.events = (function() {
                  
                      var old = (!window.addEventListener && window.attachEvent), slice = Array.prototype.slice,
                      evt = {
                        add: (old?'attachEvent':'addEventListener'),
                  Severity: Minor
                  Found in src/js/snow.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if (window.innerWidth || window.innerHeight) {
                          screenX = window.innerWidth - 16 - storm.flakeRightOffset;
                          screenY = (storm.flakeBottom || window.innerHeight);
                        } else {
                          screenX = (document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth) - (!isIE ? 8 : 0) - storm.flakeRightOffset;
                    Severity: Critical
                    Found in src/js/snow.js - About 1 hr to fix

                      Function start has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        this.start = function(bFromOnLoad) {
                          if (!didInit) {
                            didInit = true;
                          } else if (bFromOnLoad) {
                            // already loaded and running
                      Severity: Minor
                      Found in src/js/snow.js - About 1 hr to fix

                        Function update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          update: function() { //UPDATE METHOD
                            if ((TheTrulyDead.length > game.LvlEnemies) && (enemies.length === 0)) {
                              game.Lvlcomplete = true;
                              game.LvlEnemies += 5;
                              game.Lvl += 1;
                        Severity: Minor
                        Found in src/js/game.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

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

                            if (I.y !== canvas.height) {
                              return I.x >= 0 && I.x <= canvas.width &&
                                I.y >= 0 && I.y <= canvas.height;
                            } else {
                        Severity: Major
                        Found in src/js/game.js and 1 other location - About 1 hr to fix
                        src/js/game.js on lines 313..316

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

                        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

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

                          I.inBounds = function() {
                            return I.x >= 0 && I.x <= canvas.width &&
                              I.y >= 0 && I.y <= canvas.height;
                          };
                        Severity: Major
                        Found in src/js/game.js and 1 other location - About 1 hr to fix
                        src/js/game.js on lines 249..252

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

                        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 (i=0; i<this.flakes.length; i++) {
                              this.flakes[i].o.style.display = 'block';
                            }
                        Severity: Major
                        Found in src/js/snow.js and 1 other location - About 1 hr to fix
                        src/js/snow.js on lines 330..332

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

                        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 (i=0; i<this.flakes.length; i++) {
                              this.flakes[i].o.style.display = 'none';
                            }
                        Severity: Major
                        Found in src/js/snow.js and 1 other location - About 1 hr to fix
                        src/js/snow.js on lines 348..350

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

                        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