engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

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

module.exports = (function () {
  var _npc = {
    data: {},

    // Add an npc to the data object
Severity: Major
Found in client/code/game/game.npc.js - About 1 day to fix

    Function actions has a Cognitive Complexity of 53 (exceeds 5 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: Minor
    Found in server/rpc/game/npc.js - About 1 day 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 206 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.actions = function (req, res, ss) {
      req.use('session')
      req.use('account.authenticated')
    
      var userModel = ss.service.db.model('User')
    Severity: Major
    Found in server/rpc/admin/invitecodes.js - About 1 day to fix

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

      module.exports = (function () {
        var _positions = [
          {x: 7, y: 20, d: -1, target: -3},
          {x: 137, y: 33, d: 1, target: 145},
          {x: 137, y: 124, d: 1, target: 145},
      Severity: Major
      Found in client/code/game/game.robot.js - About 7 hrs to fix

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

        exports.actions = function (req, res, ss) {
          req.use('session')
        
          var npcModel = ss.service.db.model('Npc')
          var tileModel = ss.service.db.model('Tile')
        Severity: Major
        Found in server/rpc/admin/npcs.js - About 7 hrs to fix

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

          'use strict'
          /* global ss, Davis, JT, $, $CONTAINER, apprise */
          
          // PRIVATE GAME VARS
          var _stepNumber = 0
          Severity: Minor
          Found in client/code/game/game.main.js - About 7 hrs to fix

            Function addContent has 174 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              addContent: function (resourceId, section, slide) {
                var overlay = document.getElementById('resource-area')
                var answer = $game.$player.getAnswer(resourceId)
                var isAnswered = (answer && answer.result) ? true : false
                var isRevisit = $game.flags.check('viewing-inventory')
            Severity: Major
            Found in client/code/game/game.resources.js - About 6 hrs to fix

              Function actions has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
              Open

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

              module.exports = (function () {
                return {
                  ready: false,
              
                  // load in other players
              Severity: Minor
              Found in client/code/game/game.others.js - About 6 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 exports has 158 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = (function () {
                var _minimap = {}
                var _minimapPlayerContext = null
                var _minimapRadarContext = null
                var _utils
              Severity: Major
              Found in client/code/game/game.minimap.js - About 6 hrs to fix

                Function saveChanges has 143 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function saveChanges (id) {
                  var $npc = $('#admin-npcs').find('.npc' + id)
                  var informationAreas = $npc.find('.information textarea, .information input')
                  var resourceAreas = $npc.find('.resource textarea, .resource input')
                  var promptAreas = $npc.find('.prompts textarea')
                Severity: Major
                Found in client/code/admin/npcs.js - About 5 hrs to fix

                  Function addContent has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    addContent: function (section) {
                      var overlay = document.getElementById('botanist-area')
                      var content = overlay.querySelector('.botanist-content')
                  
                      // Reset all resource slides and buttons to a hidden & clean state.
                  Severity: Major
                  Found in client/code/game/game.botanist.js - About 5 hrs to fix

                    Function accountHandlers has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      accountHandlers: function () {
                        var $body = $(document.body)
                    
                        $body.on('submit', '#login-form', function() {
                          var email = document.getElementById('username').value.toLowerCase()
                    Severity: Major
                    Found in client/code/shared/account.js - About 5 hrs to fix

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

                      'use strict'
                      /* global ss, CivicSeed, $game, Howl, Howler */
                      
                      var _soundtracks = []
                      var _triggerFx = null
                      Severity: Minor
                      Found in client/code/game/game.audio.js - About 5 hrs to fix

                        Function exports has a Cognitive Complexity of 37 (exceeds 5 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: Minor
                        Found in client/code/game/game.inventory.js - About 5 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 exports has 136 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = (function () {
                          // Placeholder for chat display time, after which a setTimeout is used to hide the chat bubble.
                          var displayTimer = null
                        
                          var badWords = ['fuck', 'shit', 'bitch', 'cunt', 'damn', 'penis', 'vagina', 'crap', 'screw', 'suck', 'piss', 'whore', 'slut']
                        Severity: Major
                        Found in client/code/game/game.chat.js - About 5 hrs to fix

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

                          module.exports = (function () {
                            return {
                              ready: false,
                          
                              // load in other players
                          Severity: Major
                          Found in client/code/game/game.others.js - About 4 hrs to fix

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

                            module.exports = (function () {
                              // Placeholder for chat display time, after which a setTimeout is used to hide the chat bubble.
                              var displayTimer = null
                            
                              var badWords = ['fuck', 'shit', 'bitch', 'cunt', 'damn', 'penis', 'vagina', 'crap', 'screw', 'suck', 'piss', 'whore', 'slut']
                            Severity: Minor
                            Found in client/code/game/game.chat.js - About 4 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 init has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function init () {
                              var $body = $(document.body)
                            
                              // Intercept default browser button actions
                              $('button').on('click', function (e) {
                            Severity: Major
                            Found in client/code/admin/npcs.js - About 4 hrs to fix

                              Function transitionMap has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                              Open

                                transitionMap: function (stepNumber) {
                                  // --------RIGHT------------
                                  // go thru current array and shift everthing
                                  if ($map.stepDirection === 'right') {
                                    // shift all except last column
                              Severity: Minor
                              Found in client/code/game/game.map.js - About 4 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

                              Severity
                              Category
                              Status
                              Source
                              Language