engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

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

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

  var _userModel = ss.service.db.model('User')
  var _tileModel = ss.service.db.model('Tile')
Severity: Minor
Found in server/rpc/game/player.js - About 4 days 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 game.player.js has 1254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict'
/* global ss, $, $game, $BODY */

// TODO: Refactor

Severity: Major
Found in client/code/game/game.player.js - About 3 days to fix

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

    var $input = module.exports = (function () {
      var $body
    
      // Remember if any keys are held down, to prevent
      // repeated firings of certain keys
    Severity: Major
    Found in client/code/game/game.input.js - About 3 days to fix

      Function actions has 544 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 _tileModel = ss.service.db.model('Tile')
      Severity: Major
      Found in server/rpc/game/player.js - About 2 days to fix

        File backbone.js has 956 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        //     Backbone.js 1.1.2
        
        //     (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
        //     Backbone may be freely distributed under the MIT license.
        //     For all details and documentation:
        Severity: Major
        Found in client/code/system/backbone.js - About 2 days to fix

          File underscore.js has 931 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          //     Underscore.js 1.6.0
          //     http://underscorejs.org
          //     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
          //     Underscore may be freely distributed under the MIT license.
          
          
          Severity: Major
          Found in client/code/system/underscore.js - About 2 days to fix

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

            'use strict'
            /* global CivicSeed, ss, $, $game, d3 */
            
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
            
            
            Severity: Major
            Found in client/code/game/game.botanist.js - About 1 day to fix

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

              'use strict'
              /* global ss, $, $game, d3 */
              
              /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
              
              
              Severity: Major
              Found in client/code/game/game.resources.js - About 1 day to fix

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

                'use strict'
                /* global CivicSeed, $, $game */
                
                var _ = require('underscore')
                
                
                Severity: Major
                Found in client/code/game/game.render.js - About 1 day to fix

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

                      init: function () {
                        $body = $(document.body)
                  
                        /* * * * * * * *       GENERIC GAMEBOARD INTERACTION       * * * * * * * */
                  
                  
                  Severity: Major
                  Found in client/code/game/game.input.js - About 1 day to fix

                    Function exports has a Cognitive Complexity of 73 (exceeds 5 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: Minor
                    Found in client/code/game/game.robot.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

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

                    'use strict'
                    /* global ss, $, $game */
                    
                    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                    
                    
                    Severity: Major
                    Found in client/code/game/game.input.js - About 1 day to fix

                      Function actions has 261 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/account.js - About 1 day to fix

                        Function addContent has a Cognitive Complexity of 62 (exceeds 5 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: Minor
                        Found in client/code/game/game.resources.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 exports has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
                        Open

                        var $input = module.exports = (function () {
                          var $body
                        
                          // Remember if any keys are held down, to prevent
                          // repeated firings of certain keys
                        Severity: Minor
                        Found in client/code/game/game.input.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

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

                        'use strict'
                        /* global CivicSeed, ss, Modernizr, $, $game */
                        
                        /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                        
                        
                        Severity: Major
                        Found in client/code/game/game.boss.js - About 1 day to fix

                          exports has 64 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          var $player = module.exports = {
                          
                            firstName: null,
                            id: null,
                            game: null,
                          Severity: Major
                          Found in client/code/game/game.player.js - About 1 day to fix

                            File player.js has 550 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            'use strict'
                            
                            var rootDir = process.cwd()
                            var emailUtil = require(rootDir + '/server/utils/email')
                            var winston = require('winston')
                            Severity: Major
                            Found in server/rpc/game/player.js - About 1 day to fix

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

                              module.exports = (function () {
                                var _npc = {
                                  data: {},
                              
                                  // Add an npc to the data object
                              Severity: Minor
                              Found in client/code/game/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 _processResumeAnswers has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function _processResumeAnswers (data) {
                                for (var i = 0; i < data.resources.length; i++) {
                                  var resource = data.resources[i]
                                  if (resource.questionType === 'resume') {
                                    var answer = resource.answers[0]
                              Severity: Minor
                              Found in client/code/routes/routes.profile.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

                              Severity
                              Category
                              Status
                              Source
                              Language