engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Function loadUsers has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  loadUsers: function (req, res, ss) {
    var userData = require(rootDir + '/data/users.json')
    var userDataCopy = _JSONClone(userData)
    var numDemoUsers = 16
    var demoUsers = []
Severity: Major
Found in server/rpc/admin/startup.js - About 3 hrs to fix

    File admin.js has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    /* global ss, $, apprise */
    
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    
    
    Severity: Minor
    Found in client/code/admin/admin.js - About 3 hrs to fix

      File data.tangrams.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Ideally, this is JSON, and is formatted as such
      // But the browserify module bundled with socketstream
      // does not currently support JSON, so we just
      // manually attach it to module.exports
      
      
      Severity: Minor
      Found in client/code/data/data.tangrams.js - About 3 hrs to fix

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

          addContent: function (section) {
            var overlay = document.getElementById('boss-area')
            var speakerEl = overlay.querySelector('.dialog .speaker')
            var messageEl = overlay.querySelector('.dialog .message')
            var speaker = $game.$botanist.name
        Severity: Major
        Found in client/code/game/game.boss.js - About 3 hrs to fix

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

          'use strict'
          /* global ss, $, $game */
          
          var _nextTiles = []
          var _leftEdge = 0
          Severity: Minor
          Found in client/code/game/game.map.js - About 3 hrs to fix

            Function actions has a Cognitive Complexity of 22 (exceeds 5 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: Minor
            Found in server/rpc/admin/invitecodes.js - About 3 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 loadMiddleware has a Cognitive Complexity of 22 (exceeds 5 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 3 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 showSpeechBubble has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                showSpeechBubble: function (speaker, messages, prompt, callback) {
                  var el = document.getElementById('speech-bubble')
                  var $el = $(el) // Cache jQuery reference
                  var hasPrompt = false
                  var isMultiline = false
            Severity: Major
            Found in client/code/game/game.npc.js - About 3 hrs to fix

              Function _processResumeAnswers has 77 lines of code (exceeds 25 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: Major
              Found in client/code/routes/routes.profile.js - About 3 hrs to fix

                Function _addButton has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function _addButton (button, section, slide, callback) {
                      var buttons = overlay.querySelector('.buttons')
                      var back = buttons.querySelector('.back-button')
                      var next = buttons.querySelector('.next-button')
                      var answer = buttons.querySelector('.answer-button')
                Severity: Major
                Found in client/code/game/game.resources.js - About 3 hrs to fix

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

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

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

                    function init () {
                      // Display share link
                      showCurrentURIWithoutPrefix()
                    
                      // Set up all event listeners
                    Severity: Major
                    Found in client/code/admin/profile.js - About 3 hrs to fix

                      Function showPlayerAnswers has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function showPlayerAnswers (index) {
                        var resources = players[index].game.resources
                        var numNPC = allQuestions.length
                        var html = '<h2>' + players[index].firstName + ' ' + players[index].lastName + '</h2>'
                      
                      
                      Severity: Minor
                      Found in client/code/admin/admin.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 newGameInstance has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          newGameInstance: function (info) {
                            gameModel
                            .where('instanceName').equals(info.instanceName)
                            .select('instanceName')
                            .find(function (err, results) {
                      Severity: Major
                      Found in server/rpc/admin/invitecodes.js - About 2 hrs to fix

                        Function createCanvasForPlayer has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          createCanvasForPlayer: function (id, skinSuit, playerColor) {
                            var context = _offscreenPlayersContext[id]
                        
                            // If player's canvas currently exists, clear it
                            if (context) {
                        Severity: Major
                        Found in client/code/game/game.render.js - About 2 hrs to fix

                          Function _move has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function _move () {
                            /** IMPORTANT note: x and y are really flipped!!! **/ // is this true?
                          
                            // First, check what step of animation we are on.
                            // After one animation cycle, reset steps and moves
                          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 dropSeed has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                            dropSeed: function (options) {
                              if (options.x !== undefined && options.x >= 0) {
                                options.mX = $game.$map.currentTiles[options.x][options.y].x
                                options.mY = $game.$map.currentTiles[options.x][options.y].y
                              }
                          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 exports has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                          module.exports = (function () {
                            // Private - holder of graph tiles for current screen
                            var _graph
                          
                            return {
                          Severity: Minor
                          Found in client/code/game/game.pathfinder.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 checkPuzzleAnswer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            checkPuzzleAnswer: function () {
                              var allTangrams = $('.puzzle-svg > path')
                              var correct = true
                              var numRight = 0
                              var aLength = $botanist.tangram[$game.$player.currentLevel].answer.length
                          Severity: Major
                          Found in client/code/game/game.botanist.js - About 2 hrs to fix

                            File account.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            'use strict'
                            
                            var rootDir = process.cwd()
                            var bcrypt = require('bcrypt')
                            var xkcd = require('xkcd-pwgen')
                            Severity: Minor
                            Found in server/rpc/shared/account.js - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language