engagementgamelab/CivicSeed

View on GitHub

Showing 421 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

              Similar blocks of code found in 2 locations. 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: Major
              Found in server/rpc/game/npc.js and 1 other location - About 1 day to fix
              server/rpc/game/npc.js on lines 61..94

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 319.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. 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: Major
              Found in server/rpc/game/npc.js and 1 other location - About 1 day to fix
              server/rpc/game/npc.js on lines 96..129

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 319.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            getMapData: function(x1, y1, x2, y2) {
                              tileModel
                                .where('x').gte(x1).lt(x2)
                                .where('y').gte(y1).lt(y2)
                                .sort('mapIndex')
                        Severity: Major
                        Found in server/rpc/game/map.js and 1 other location - About 1 day to fix
                        server/rpc/game/player.js on lines 306..329

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 242.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            getMapData: function (x1, y1, x2, y2) {
                              _tileModel
                                .where('x').gte(x1).lt(x2)
                                .where('y').gte(y1).lt(y2)
                                .sort('mapIndex')
                        Severity: Major
                        Found in server/rpc/game/player.js and 1 other location - About 1 day to fix
                        server/rpc/game/map.js on lines 11..34

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 242.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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