engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function createUserAndSendInvite has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var createUserAndSendInvite = function (email, instanceName, i) {
    // Note: All invites assume a NEW USER. This means if the user is
    // already in the system, this OVERWRITES their account.

    // TODO: Figure out how to work around this properly.
Severity: Major
Found in server/rpc/admin/invitecodes.js - About 2 hrs to fix

    Function set has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        set: function(models, options) {
          options = _.defaults({}, options, setOptions);
          if (options.parse) models = this.parse(models, options);
          var singular = !_.isArray(models);
          models = singular ? (models ? [models] : []) : _.clone(models);
    Severity: Major
    Found in client/code/system/backbone.js - About 2 hrs to fix

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

      var $game = module.exports = {
      
        // GLOBAL GAME CONSTANTS
        VIEWPORT_WIDTH: 30,
        VIEWPORT_HEIGHT: 15,
      Severity: Minor
      Found in client/code/game/game.main.js - About 2 hrs to fix

        Function dateFormat has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var dateFormat = function () {
            var    token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,
                timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
                timezoneClip = /[^-+\dA-Z]/g,
                pad = function (val, len) {
        Severity: Major
        Found in server/utils/date-format.js - About 2 hrs to fix

          Function displayNpcComments has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            displayNpcComments: function () {
              // Clear any previous comment bubbles
              $player.clearNpcComments()
          
              // Get on-screen NPCs
          Severity: Major
          Found in client/code/game/game.player.js - About 2 hrs to fix

            Function gameColorUpdate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                gameColorUpdate: function (newInfo, instanceName, callback) {
                  // access our global game model for status updates
                  _gameModel
                    .where('instanceName').equals(instanceName)
                    .find(function (err, results) {
            Severity: Major
            Found in server/rpc/game/player.js - About 2 hrs to fix

              Function transitionMap has 62 lines of code (exceeds 25 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: Major
              Found in client/code/game/game.map.js - About 2 hrs to fix

                Function hashDemoData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function hashDemoData (i) {
                      if (i < numDemoUsers) {
                        accountHelpers.hashPassword('demo', function (hashedPassword) {
                          // create demo users
                          var d = {
                Severity: Major
                Found in server/rpc/admin/startup.js - About 2 hrs to fix

                  Function drawMapTile has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    drawMapTile: function (tileData) {
                      var srcX, srcY
                  
                      var tilesheetIndex = tileData.colored ? 1 : 0
                      // background1, the ground texture
                  Severity: Major
                  Found in client/code/game/game.render.js - About 2 hrs to fix

                    Function eq has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var eq = function(a, b, aStack, bStack) {
                        // Identical objects are equal. `0 === -0`, but they aren't identical.
                        // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
                        if (a === b) return a !== 0 || 1 / a == 1 / b;
                        // A strict comparison is necessary because `null == undefined`.
                    Severity: Major
                    Found in client/code/system/underscore.js - About 2 hrs to fix

                      File astar.js has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // javascript-astar 0.3.0
                      // http://github.com/bgrins/javascript-astar
                      // Freely distributable under the MIT License.
                      // Implements the astar search algorithm in javascript using a Binary Heap.
                      // Includes Binary Heap (with modifications) from Marijn Haverbeke.
                      Severity: Minor
                      Found in client/code/system/astar.js - About 2 hrs to fix

                        File startup.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        'use strict'
                        
                        var rootDir = process.cwd()
                        var winston = require('winston')
                        
                        
                        Severity: Minor
                        Found in server/rpc/admin/startup.js - About 2 hrs to fix

                          _resources has 22 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          var _resources = {
                          
                            data: [],
                            temporaryAnswer: '',
                          
                          
                          Severity: Minor
                          Found in client/code/game/game.resources.js - About 2 hrs to fix

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

                            var $audio = module.exports = {
                            
                              ready: false,
                              isMute: false,
                            
                            
                            Severity: Minor
                            Found in client/code/game/game.audio.js - About 2 hrs to fix

                              Function setupInviteCodes has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function setupInviteCodes () {
                                $body.on('submit', '#admin-invites form', function (event) {
                                  // Prevent the 'enter' key on some browsers from
                                  // submitting the form in the wrong way
                                  event.preventDefault()
                              Severity: Major
                              Found in client/code/admin/invitecodes.js - About 2 hrs to fix

                                Function beginMove has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  beginMove: function (targetPosition) {
                                    var localPosition = $player.getLocalPosition()
                                    var path
                                
                                    // Clear HUD
                                Severity: Minor
                                Found in client/code/game/game.player.js - About 2 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 move has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                Player.prototype.move = function () {
                                  // if the steps between the tiles has finished,
                                  // update the master location, and reset steps to go on to next move
                                  if (this.currentStep >= this.numSteps) {
                                    this.currentStep = 0
                                Severity: Minor
                                Found in client/code/game/game.others.js - About 2 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 search has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    search: function(graph, start, end, options) {
                                        astar.init(graph);
                                
                                        options = options || {};
                                        var heuristic = options.heuristic || astar.heuristics.manhattan;
                                Severity: Major
                                Found in client/code/system/astar.js - About 2 hrs to fix

                                  Function onClick has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function onClick (mouseInfo) {
                                    if (mouseInfo.event.which === 3) {
                                      console.log('Right mouse button clicked')
                                    }
                                  
                                  
                                  Severity: Major
                                  Found in client/code/game/game.mouse.js - About 2 hrs to fix

                                    Function calculateSeeds has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      calculateSeeds: function (options) {
                                        var tiles = []
                                    
                                        // Get the tiles that need to be bombed
                                        if (options.radius > 1) {
                                    Severity: Major
                                    Found in client/code/game/game.player.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language