engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

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

exports.actions = function (req, res, ss) {
  req.use('session')

  var gameModel = ss.service.db.model('Game')
  var npcModel = ss.service.db.model('Npc')
Severity: Major
Found in server/rpc/admin/monitor.js - About 4 hrs to fix

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

    exports.actions = function (req, res, ss) {
      req.use('session')
    
      var UserModel = ss.service.db.model('User')
      var GameModel = ss.service.db.model('Game')
    Severity: Major
    Found in server/rpc/shared/profiles.js - About 4 hrs to fix

      Function makeResumeFormHTML has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        makeResumeFormHTML: function (resource) {
          var html = ''
      
          // Notes on questions and desired functionality from Sam's Google Doc
          switch (resource.answer) {
      Severity: Major
      Found in client/code/game/game.resources.js - About 4 hrs to fix

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

        exports.actions = function (req, res, ss) {
          req.use('session')
        
          var Npc = ss.service.db.model('Npc')
          var Game = ss.service.db.model('Game')
        Severity: Major
        Found in server/rpc/game/npc.js - About 4 hrs to fix

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

          'use strict'
          /* global ss, $, $game */
          
          /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
          
          
          Severity: Minor
          Found in client/code/game/game.others.js - About 4 hrs to fix

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

            module.exports = (function () {
              var _inventory = {} // Holds each item in inventory.
            
              // Returns true if a resource is held in the player's inventory
              function isInInventory (item) {
            Severity: Major
            Found in client/code/game/game.inventory.js - About 4 hrs to fix

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

              'use strict'
              /* global ss, $, $game */
              
              /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
              
              
              Severity: Minor
              Found in client/code/game/game.npc.js - About 4 hrs to fix

                _botanist has 33 functions (exceeds 20 allowed). Consider refactoring.
                Open

                var _botanist = {
                
                  data: {},
                  state: null,
                  tutorialState: 0,
                Severity: Minor
                Found in client/code/game/game.botanist.js - About 4 hrs to fix

                  File data.skinsuits.js has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  // Ideally, this is JSON, and is formatted as such
                  // But the browserify module bundled with socketstream
                  // does not currently support JSON, so we just
                  // manually attach it to module.exports
                  
                  
                  Severity: Minor
                  Found in client/code/data/data.skinsuits.js - About 4 hrs to fix

                    _boss has 32 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    var _boss = {
                    
                      grid: [],
                      totalScore: null,
                      modeScore: null,
                    Severity: Minor
                    Found in client/code/game/game.boss.js - About 4 hrs to fix

                      Function calculateSeeds has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                        calculateSeeds: function (options) {
                          var tiles = []
                      
                          // Get the tiles that need to be bombed
                          if (options.radius > 1) {
                      Severity: Minor
                      Found in client/code/game/game.player.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

                      File npcs.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      'use strict'
                      /* global CivicSeed, ss, $, apprise */
                      
                      /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                      
                      
                      Severity: Minor
                      Found in client/code/admin/npcs.js - About 3 hrs to fix

                        Function displayNpcComments has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                        Open

                          displayNpcComments: function () {
                            // Clear any previous comment bubbles
                            $player.clearNpcComments()
                        
                            // Get on-screen NPCs
                        Severity: Minor
                        Found in client/code/game/game.player.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 drawSeed has a Cognitive Complexity of 26 (exceeds 5 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 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 actions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                        Open

                        exports.actions = function (req, res, ss) {
                          req.use('session')
                        
                          var gameModel = ss.service.db.model('Game')
                          var npcModel = ss.service.db.model('Npc')
                        Severity: Minor
                        Found in server/rpc/admin/monitor.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 onClick has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function onClick (mouseInfo) {
                          if (mouseInfo.event.which === 3) {
                            console.log('Right mouse button clicked')
                          }
                        
                        
                        Severity: Minor
                        Found in client/code/game/game.mouse.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 loadRoutes has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          loadRoutes: function (app) {
                            require('/admin').init()
                            require('/export').init()
                            require('/invitecodes').init()
                        
                        
                        Severity: Major
                        Found in client/code/routes/routes.admin.js - About 3 hrs to fix

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

                            init: function () {
                              // When a new player has joined
                              ss.event.on('ss-addPlayer', function (data, chan) {
                                $game.$others.add(data.info)
                                if (data.info._id !== $game.$player.id) {
                          Severity: Major
                          Found in client/code/game/game.events.js - About 3 hrs to fix

                            Function renderTiles has a Cognitive Complexity of 25 (exceeds 5 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 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 setupMonitor has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function setupMonitor () {
                              getQuestions()
                            
                              $body.on('click', '#players', function () {
                                var instance = $(this).attr('data-instance')
                            Severity: Major
                            Found in client/code/admin/admin.js - About 3 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language