engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function debounce has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _.debounce = function(func, wait, immediate) {
    var timeout, args, context, timestamp, result;

    var later = function() {
      var last = _.now() - timestamp;
Severity: Minor
Found in client/code/system/underscore.js - About 1 hr to fix

    Function endGameEmails has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        endGameEmails: function (instanceName) {
          // set boss mode unlocked here for specific instance
    
          // send out emails to players who have completed game
          _userModel
    Severity: Minor
    Found in server/rpc/game/player.js - About 1 hr to fix

      Function pledgeSeed has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          pledgeSeed: function (info) {
            _userModel.findById(info.id, function (err, user) {
              if (err) {
                console.log(err)
              } else if (user) {
      Severity: Minor
      Found in server/rpc/game/player.js - About 1 hr to fix

        Function startGame has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          startGame: function (ingame) {
            if ($game.bossModeUnlocked && $game.$player.currentLevel > 3) {
              $game.$boss.init()
            }
        
        
        Severity: Minor
        Found in client/code/game/game.main.js - About 1 hr to fix

          Function loadOtherTrack has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            loadOtherTrack: function (track, num) {
              if (track !== num) {
                var mp3 = _musicPath + track + '.mp3?VERSION='
                var ogg = _musicPath + '/ogg/' + '.ogg?VERSION='
          
          
          Severity: Minor
          Found in client/code/game/game.audio.js - About 1 hr to fix

            Function beginTransition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              beginTransition: function () {
                // Verify that the player is at the edge of a screen
                // Refuse transition if player is not at a transitional edge
                // This catches bugs
                var position = $game.$player.getLocalPosition()
            Severity: Minor
            Found in client/code/game/game.main.js - About 1 hr to fix

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

                function move () {
                  var currentStepIncX = _info.d
                  var currentStepIncY = 0
              
                  if (_onScreen) {
              Severity: Minor
              Found in client/code/game/game.robot.js - About 1 hr to fix

                Function deAuthenticate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    deAuthenticate: function () {
                      winston.info('Deauthenticating...')
                      // console.log(req.session.firstName, req.session.email, req.session.role, req.session.gameChannel, req.session.userId);
                
                      var sessionId = req.sessionId
                Severity: Minor
                Found in server/rpc/shared/account.js - About 1 hr to fix

                  Function remindMeMyPassword has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      remindMeMyPassword: function (email) {
                        UserModel.findOne({ email: email }, function (err, user) {
                          if (!err && user) {
                            // TODO THIS AUTO RESETS without creds!!
                            var password = xkcd.generatePassword()
                  Severity: Minor
                  Found in server/rpc/shared/account.js - About 1 hr to fix

                    Function _setPlayerInformation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function _setPlayerInformation (info) {
                      // Ensure that flags start from a clean state
                      $game.flags.unsetAll()
                    
                      // private
                    Severity: Minor
                    Found in client/code/game/game.player.js - About 1 hr to fix

                      Function checkState has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        checkState: function () {
                          // Prevent check from occurring if Botanist state is not at 2 or 3
                          // (resource collecting mode)
                          if ($botanist.getState() < 2) return false
                      
                      
                      Severity: Minor
                      Found in client/code/game/game.botanist.js - About 1 hr to fix

                        Function saveOtherCommunityResources has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          saveOtherCommunityResources: function (answeredResourceId) {
                            // Hack for community inventory items
                            // Dummy data for other resources
                            var ids = [4001, 4002, 4003]
                            var bunchOfResources = []
                        Severity: Minor
                        Found in client/code/game/game.player.js - About 1 hr to fix

                          Function onTangramDrag has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            onTangramDrag: function (d) {
                              var x = d3.event.sourceEvent.layerX
                              var y = d3.event.sourceEvent.layerY
                          //        mX       = d3.event.x
                          //        mY       = d3.event.y
                          Severity: Minor
                          Found in client/code/game/game.botanist.js - About 1 hr to fix

                            Function nextLevel has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              nextLevel: function () {
                                $player.currentLevel += 1
                                $player.seenRobot = false
                                $game.$botanist.setState(0)
                                $game.flags.unset('botanist-teleported')
                            Severity: Minor
                            Found in client/code/game/game.player.js - About 1 hr to fix

                              Function Npc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function Npc (data) {
                                this.name = data.name
                                this.id = data.id
                                this.sprite = data.sprite
                                this.level = data.level
                              Severity: Minor
                              Found in client/code/game/game.npc.js - About 1 hr to fix

                                Function loadEnvironmentLoopFx has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  loadEnvironmentLoopFx: function () {
                                    var mp3 = _musicPath + 'environmentloop.mp3?VERSION='
                                    var ogg = _musicPath + '/ogg/environmentloop.ogg?VERSION='
                                
                                    if (_extension) {
                                Severity: Minor
                                Found in client/code/game/game.audio.js - About 1 hr to fix

                                  Function renderTile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    renderTile: function (i, j) {
                                      // get the index (which refers to the location of the image)
                                      // tilemap reference to images starts at 1 instead of 0
                                      var curTile = $game.$map.currentTiles[i][j]
                                      var backIndex1 = curTile.background - 1
                                  Severity: Minor
                                  Found in client/code/game/game.render.js - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                        if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
                                                                 _.isFunction(bCtor) && (bCtor instanceof bCtor))
                                                            && ('constructor' in a && 'constructor' in b)) {
                                          return false;
                                        }
                                    Severity: Major
                                    Found in client/code/system/underscore.js - About 1 hr to fix

                                      Function enterGame has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        enterGame: function (callback) {
                                          // Check if they are ACTUALLY playing
                                          ss.rpc('shared.account.checkGameSession', function (response) {
                                            // YOU KNOW, THIS COULD ALL HAPPEN ELSEWHERE?
                                            if (!$game.instantiated) {
                                      Severity: Minor
                                      Found in client/code/game/game.main.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 loadOtherTrack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        loadOtherTrack: function (track, num) {
                                          if (track !== num) {
                                            var mp3 = _musicPath + track + '.mp3?VERSION='
                                            var ogg = _musicPath + '/ogg/' + '.ogg?VERSION='
                                      
                                      
                                      Severity: Minor
                                      Found in client/code/game/game.audio.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language