fassetar/penguins-rising

View on GitHub

Showing 17 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

          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

                        Consider simplifying this complex logical expression.
                        Open

                          if (welcome.leaderboards_loaded &&
                            welcome.achievement_defs_loaded &&
                            welcome.achievement_progress_loaded &&
                            welcome.player_data_loaded &&
                            welcome.challenge_loaded &&
                        Severity: Major
                        Found in src/js/login.js - About 1 hr to fix

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

                          welcome.dataLoaded = function(whatData) {
                            if (whatData === welcome.ENUM_LEADERBOARDS) {
                              welcome.leaderboards_loaded = true;
                            } else if (whatData === welcome.ENUM_ACHIEVEMENT_DEFS) {
                              welcome.achievement_defs_loaded = true;
                          Severity: Minor
                          Found in src/js/login.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

                          Function buildTableRowFromData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          achievementTable.buildTableRowFromData = function(achObject) {
                              var $tableRow = $('<tr></tr>');
                              var $achievementName = $('<td></td>').text(achObject.name).addClass('achievementName');
                              var $achievementDescrip = $('<td></td>').text(achObject.description).addClass('achievementDescrip');
                              var $achievementURL = '';
                          Severity: Minor
                          Found in src/js/achievements.js - About 25 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