engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function makeResponsePrivate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    makeResponsePrivate: function (data) {
      Game.where('instanceName').equals(data.instanceName)
        .find(function (err, game) {
          if (err) {
            winston.error('Could not find game', err)
Severity: Minor
Found in server/rpc/game/npc.js - About 1 hr to fix

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

    exports.actions = function (req, res, ss) {
      req.use('session')
    
      var tileModel = ss.service.db.model('Tile')
      var colorModel = ss.service.db.model('Color')
    Severity: Minor
    Found in server/rpc/game/map.js - About 1 hr to fix

      Function message has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          message: function (data) {
            var gameboard = document.getElementById('gameboard')
            var bubbleEl = document.getElementById('chat-' + data.id)
            var pointerEl = document.getElementById('pointer-' + data.id)
            var name = 'me'
      Severity: Minor
      Found in client/code/game/game.chat.js - About 1 hr to fix

        Function loadData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            loadData: function (dataType) {
              if (req.session.role && req.session.role === 'superadmin') {
                winston.info(filename + ' Loading data for collection: '.magenta + dataType.yellow.underline + ' ...'.magenta)
        
                switch (dataType) {
        Severity: Minor
        Found in server/rpc/admin/startup.js - About 1 hr to fix

          Function saveResourceLocally has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            saveResourceLocally: function (data) {
              var playerResource = _resources[data.id]
          
              // See if the resource is already in the player's game data
              // If so, retrieve it and update it
          Severity: Minor
          Found in client/code/game/game.player.js - About 1 hr to fix

            Function uploadToS3 has 29 lines of code (exceeds 25 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

              Function init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                init: function (callback) {
                  console.log('Initializing all modules')
              
                  // Instantiating code
                  this.flags = require('/game.flags')
              Severity: Minor
              Found in client/code/game/game.main.js - About 1 hr to fix

                Function idleCheckTrigger has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function idleCheckTrigger () {
                    currentStep++
                    if (currentStep % 8 === 0) {
                      if (currentStep > numSteps) {
                        currentStep = 0
                Severity: Minor
                Found in client/code/game/game.robot.js - About 1 hr to fix

                  Function init has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    init: function (callback) {
                      // Optimize display for higher-pixel-density screens (e.g. Retina)
                      if (window.devicePixelRatio) {
                        $game.PIXEL_RATIO = window.devicePixelRatio
                      }
                  Severity: Minor
                  Found in client/code/game/game.render.js - About 1 hr to fix

                    Function addMessage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        addMessage: function (data) {
                          var el = document.getElementById('game-log')
                          var date = Date()
                          var displayDate = date.substring(0, 10) + date.substring(15, 24)
                          var html
                    Severity: Minor
                    Found in client/code/game/game.log.js - About 1 hr to fix

                      Function exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      module.exports = (function () {
                        function setupRouter () {
                          // Note: Davis.js has not been actively
                          // supported since v0.9.9 in 2012.
                          var app = Davis(function () {
                      Severity: Minor
                      Found in client/code/main/civicseed-engine.js - About 1 hr to fix

                        Function exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = (function () {
                          return {
                            // Generates a hashed password and salt
                            hashPassword: function (password, cb) {
                              bcrypt.genSalt(10, function (err, salt) {
                        Severity: Minor
                        Found in server/utils/account-helpers.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 saveResourceLocally has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                          saveResourceLocally: function (data) {
                            var playerResource = _resources[data.id]
                        
                            // See if the resource is already in the player's game data
                            // If so, retrieve it and update it
                        Severity: Minor
                        Found in client/code/game/game.player.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 actions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        exports.actions = function (req, res, ss) {
                          req.use('session')
                        
                          var tileModel = ss.service.db.model('Tile')
                          var colorModel = ss.service.db.model('Color')
                        Severity: Minor
                        Found in server/rpc/game/map.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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        module.exports = (function () {
                          var logCounter = new Counter()
                        
                          return {
                        
                        
                        Severity: Minor
                        Found in client/code/game/game.log.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 createCanvasForPlayer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                          createCanvasForPlayer: function (id, skinSuit, playerColor) {
                            var context = _offscreenPlayersContext[id]
                        
                            // If player's canvas currently exists, clear it
                            if (context) {
                        Severity: Minor
                        Found in client/code/game/game.render.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 startGame has a Cognitive Complexity of 10 (exceeds 5 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

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

                        function unlockSkin (skin, part) {
                          var skinventory = $game.$player.getSkinventory()
                        
                          if (part !== undefined) {
                            // If part already exists, skip.
                        Severity: Minor
                        Found in client/code/game/game.skins.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 authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                          authenticate: function (email, password) {
                            ss.rpc('shared.account.authenticate', email, password, function (response) {
                              var session
                        
                              if (response.status) {
                        Severity: Minor
                        Found in client/code/shared/account.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 throttle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _.throttle = function(func, wait, options) {
                            var context, args, result;
                            var timeout = null;
                            var previous = 0;
                            options || (options = {});
                        Severity: Minor
                        Found in client/code/system/underscore.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language