engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function drawSeed has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  drawSeed: function (pos) {
    if (_seeds.draw > 0) {
      var drawLocal = false
      if ($player.seedMode === 'draw') {
        var currentTile = $game.$map.currentTiles[pos.x][pos.y]
Severity: Minor
Found in client/code/game/game.player.js - About 1 hr to fix

    Function dropSeed has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      dropSeed: function (options) {
        if (options.x !== undefined && options.x >= 0) {
          options.mX = $game.$map.currentTiles[options.x][options.y].x
          options.mY = $game.$map.currentTiles[options.x][options.y].y
        }
    Severity: Minor
    Found in client/code/game/game.player.js - About 1 hr to fix

      Function sendSeedBomb has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        sendSeedBomb: function (data) {
          var waitingEl = document.getElementById('waiting-for-seed')
      
          // set a waiting boolean so we don't plant more until receive data back from rpc
          $game.flags.set('awaiting-seed')
      Severity: Minor
      Found in client/code/game/game.player.js - About 1 hr to fix

        Function onload has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _tilesheets[filename].onload = function () {
              var next = num + 1
        
              // If last image, go load skins?
              if (num === _render.images.length - 1) {
        Severity: Minor
        Found in client/code/game/game.render.js - About 1 hr to fix

          Function moveStraight has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            moveStraight: function (direction) {
              var location
              var targetPosition
              var x, y
          
          
          Severity: Minor
          Found in client/code/game/game.player.js - About 1 hr to fix

            Function calculateNext has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              calculateNext: function (x, y) {
                var getThisManyX
                var getThisManyY
                var getThisX
                var getThisY
            Severity: Minor
            Found in client/code/game/game.map.js - About 1 hr to fix

              Function template has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _.template = function(text, data, settings) {
                  var render;
                  settings = _.defaults({}, settings, _.templateSettings);
              
                  // Combine delimiters into one regular expression via alternation.
              Severity: Minor
              Found in client/code/system/underscore.js - About 1 hr to fix

                Function updateTiles has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    updateTiles: function (oldPosition, newPosition, callback) {
                      // update new tile, make sure we can change it
                      if ((oldPosition.x === newPosition.x) && (oldPosition.y === newPosition.y)) {
                        callback()
                      } else {
                Severity: Minor
                Found in server/rpc/admin/npcs.js - About 1 hr to fix

                  Function loadResponses has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    loadResponses: function (resource) {
                      var el = document.getElementById('resource-area').querySelector('.resource-responses')
                      var playerResource = $game.$player.getAnswer(resource.id)
                      var playerPublic = false
                      var playerHTML = ''
                  Severity: Minor
                  Found in client/code/game/game.resources.js - About 1 hr to fix

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

                    Player.prototype.move = function () {
                      // if the steps between the tiles has finished,
                      // update the master location, and reset steps to go on to next move
                      if (this.currentStep >= this.numSteps) {
                        this.currentStep = 0
                    Severity: Minor
                    Found in client/code/game/game.others.js - About 1 hr to fix

                      Function checkState has a Cognitive Complexity of 13 (exceeds 5 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

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

                      S3Uploader.prototype.uploadToS3 = function (file, url, public_url) {
                        var this_s3upload, xhr
                        this_s3upload = this
                        xhr = this.createCORSRequest('PUT', url)
                        if (!xhr) {
                      Severity: Minor
                      Found in client/code/admin/profile.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

                      Function chooseResumeResponses has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        chooseResumeResponses: function (data) {
                          var numberToGet = 4
                          var allResponses = _removeCurrentPlayer(data)
                          var theChosenOnes = []
                      
                      
                      Severity: Minor
                      Found in client/code/game/game.boss.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

                      Function doTutorial has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        doTutorial: function () {
                          var tutorialState = _botanist.tutorialState
                          var dialogue = ''
                      
                          switch (tutorialState) {
                      Severity: Minor
                      Found in client/code/game/game.botanist.js - About 1 hr to fix

                        Function beginMove has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          beginMove: function (targetPosition) {
                            var localPosition = $player.getLocalPosition()
                            var path
                        
                            // Clear HUD
                        Severity: Minor
                        Found in client/code/game/game.player.js - About 1 hr to fix

                          Function renderTiles has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            renderTiles: function (position) {
                              var topLeftX = position.x - 1
                              var topLeftY = position.y - 1
                              var squares = []
                              var min = 100
                          Severity: Minor
                          Found in client/code/game/game.boss.js - About 1 hr to fix

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

                            exports.actions = function (req, res, ss) {
                              req.use('session')
                              req.use('account.authenticated')
                            
                              return {
                            Severity: Minor
                            Found in server/rpc/profile/mugshot.js - About 1 hr to fix

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

                                show: function () {
                                  var level = $game.$player.currentLevel
                              
                                  // Clear nudges if present
                                  clearInterval(_botanist.nudgePlayerInterval)
                              Severity: Minor
                              Found in client/code/game/game.botanist.js - About 1 hr to fix

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

                                  Backbone.sync = function(method, model, options) {
                                    var type = methodMap[method];
                                
                                    // Default options, unless specified.
                                    _.defaults(options || (options = {}), {
                                Severity: Minor
                                Found in client/code/system/backbone.js - About 1 hr to fix

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

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