engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function loadRewards has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  loadRewards: function (resource) {
    var el = document.getElementById('resource-area').querySelector('.resource-content')
    var input = el.querySelector('.tagline-input input')
    var npc = $game.$npc.findNpcByResourceId(resource.id)
    var playerLevel = $game.$player.currentLevel
Severity: Minor
Found in client/code/game/game.resources.js - About 1 hr to fix

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

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

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

        init: function (callback) {
          // Get all resources
          var npcs = $game.$npc.getNpcData()
      
          $.each(npcs, function (key, npc) {
      Severity: Minor
      Found in client/code/game/game.resources.js - About 1 hr to fix

        Function onTangramDrop has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          onTangramDrop: function (e) {
            e.preventDefault()
            e.stopPropagation()
        
            // Fetch tangram data from the data passed through the event data transfer
        Severity: Minor
        Found in client/code/game/game.botanist.js - About 1 hr to fix

          Function activate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              activate: function (npcId) {
                var MASTER_NPC_ID = 64
                var npc = this.get(npcId)
                var botanistState = $game.$botanist.getState()
          
          
          Severity: Minor
          Found in client/code/game/game.npc.js - About 1 hr to fix

            Function loadSkinSuitImages has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              loadSkinSuitImages: function (num) {
                if (num === undefined) num = 0
            
                var next = num + 1
                var skinsList = $game.$skins.getSetsList()
            Severity: Minor
            Found in client/code/game/game.render.js - About 1 hr to fix

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

                Function resetInit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  resetInit: function () {
                    _curFrame = 0
                    _currentStepIncX = 0
                    _currentStepIncY = 0
                    _direction = 0
                Severity: Minor
                Found in client/code/game/game.player.js - About 1 hr to fix

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

                  exports.actions = function (req, res, ss) {
                    req.use('session')
                  
                    // Set up Markdown parser
                    var md = new Remarkable('full', {
                  Severity: Minor
                  Found in server/rpc/game/resource.js - About 1 hr to fix

                    Function update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      update: function () {
                        var trackNum = whichTrack()
                        var message = 'Entering '
                    
                        if (_soundtracks[trackNum]._loaded && trackNum !== _currentTrack && !_midTransition) {
                    Severity: Minor
                    Found in client/code/game/game.audio.js - About 1 hr to fix

                      Function drawForegroundTile has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        drawForegroundTile: function (tileData) {
                          var srcX, srcY
                      
                          var tilesheetIndex = tileData.colored ? 1 : 0
                          if (tileData.f1 > -1) {
                      Severity: Minor
                      Found in client/code/game/game.render.js - About 1 hr to fix

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

                        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 loadResponses has a Cognitive Complexity of 11 (exceeds 5 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

                        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 init has a Cognitive Complexity of 11 (exceeds 5 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: Minor
                        Found in client/code/game/game.events.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 signS3Request has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            signS3Request: function (playerId, file) {
                              winston.info('Request to upload a profile image:', playerId, file.name, file.type, file.size)
                        
                              var NODE_ENV = config.get('NODE_ENV')
                              var S3_BUCKET = config.get('MUGSHOTS_S3_BUCKET')
                        Severity: Minor
                        Found in server/rpc/profile/mugshot.js - About 1 hr to fix

                          Function neighbors has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          Graph.prototype.neighbors = function(node) {
                              var ret = [],
                                  x = node.x,
                                  y = node.y,
                                  grid = this.grid;
                          Severity: Minor
                          Found in client/code/system/astar.js - About 1 hr to fix

                            Function actions has 30 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/admin/db.js - About 1 hr to fix

                              Function bubbleUp has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  bubbleUp: function(n) {
                                      // Look up the target element and its score.
                                      var length = this.content.length,
                                          element = this.content[n],
                                          elemScore = this.scoreFunction(element);
                              Severity: Minor
                              Found in client/code/system/astar.js - About 1 hr to fix

                                Function loadMiddleware has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  loadMiddleware: function (app) {
                                    // check if user experiences/authentic
                                    app.before(function (req) {
                                      var fullPath = req.fullPath
                                      var userRole = sessionStorage.getItem('userRole')
                                Severity: Minor
                                Found in client/code/routes/routes.middleware.js - About 1 hr to fix

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

                                      makeResponsePublic: 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language