engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

Avoid deeply nested control flow statements.
Open

                        if (err) {
                          callback('could not find old tile')
                        } else if (oldTiles) {
                          oldTiles[0].tileState = 0
                          oldTiles[0].save(function (err, saved) {
Severity: Major
Found in server/rpc/admin/npcs.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (neighbor.h < closestNode.h || (neighbor.h === closestNode.h && neighbor.g < closestNode.g)) {
                                closestNode = neighbor;
                            }
    Severity: Major
    Found in client/code/system/astar.js - About 45 mins to fix

      Function saveResource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        saveResource: function (resource) {
          var playerResource = _resources[resource.id]
          var npc = $game.$npc.findNpcByResourceId(resource.id)
          var npcLevel = npc.getLevel()
          var playerLevel = $player.getLevel()
      Severity: Minor
      Found in client/code/game/game.player.js - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                      if (err) {
                        callback(err)
                      } else {
                        callback()
                      }
      Severity: Major
      Found in server/utils/database-actions.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
                          (context && context !== ev.context)) {
                        retain.push(ev);
                      }
        Severity: Major
        Found in client/code/system/backbone.js - About 45 mins to fix

          Function getNetworkIPs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            getNetworkIPs: function(callback, bypassCache) {
              if (cached && !bypassCache) {
                callback(null, cached)
                return
              }
          Severity: Minor
          Found in server/utils/server-helpers.js - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                              if (info.resource.questionType === 'multiple') {
                                npc.resource.possibleAnswers = info.resource.possibleAnswers
                              }
          Severity: Major
          Found in server/rpc/admin/npcs.js - About 45 mins to fix

            Function init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              init: function () {
                $(document).keydown(function (e) {
                  if ($('.appriseOverlay').is(':visible')) {
                    if (e.keyCode === 13) {
                      e.preventDefault() // This line got added
            Severity: Minor
            Found in client/code/main/apprise.patch.js - About 45 mins 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 renderSkinventoryUI has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            function renderSkinventoryUI () {
              var playerSkin = $game.$player.getSkinSuit()
              var unlocked = $game.$player.getSkinventory()
              var skins = getSets()
            
            
            Severity: Minor
            Found in client/code/game/game.skins.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                        if (_boss.items[itemId].immediate === true) _boss.activateItem(tile)
            Severity: Major
            Found in client/code/game/game.boss.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (key === 'resume-experience') {
                          processedOrg.push(value)
                        } else if (key === 'resume-experience-content') {
                          processedSummary.push(value)
                        }
              Severity: Major
              Found in client/code/routes/routes.profile.js - About 45 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
                      params.contentType = 'application/json';
                      params.data = JSON.stringify(options.attrs || model.toJSON(options));
                    }
                Severity: Major
                Found in client/code/system/backbone.js - About 40 mins to fix

                  Function createCanvas has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    createCanvas: function (elementId, width, height, onDOM, styles) {
                  Severity: Minor
                  Found in client/code/game/game.render.js - About 35 mins to fix

                    Function doTutorial has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      doTutorial: function () {
                        var tutorialState = _botanist.tutorialState
                        var dialogue = ''
                    
                        switch (tutorialState) {
                    Severity: Minor
                    Found in client/code/game/game.botanist.js - About 35 mins 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 idle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      idle: function () {
                        _counter += 1
                    
                        if (_botanist.renderInfo.srcY === 0) {
                          if (_counter >= 24) {
                    Severity: Minor
                    Found in client/code/game/game.botanist.js - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      init: function (callback) {
                        // Get all resources
                        var npcs = $game.$npc.getNpcData()
                    
                        $.each(npcs, function (key, npc) {
                    Severity: Minor
                    Found in client/code/game/game.resources.js - About 35 mins 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 loadTilesheets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      loadTilesheets: function (num) {
                        var path = CivicSeed.CLOUD_PATH + '/img/game/'
                        var ext = '.png'
                    
                        // load the images recursively until done
                    Severity: Minor
                    Found in client/code/game/game.render.js - About 35 mins 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

                    Avoid too many return statements within this function.
                    Open

                          if (aStack[length] == a) return bStack[length] == b;
                    Severity: Major
                    Found in client/code/system/underscore.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false;
                      Severity: Major
                      Found in client/code/system/underscore.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return result;
                        Severity: Major
                        Found in client/code/system/underscore.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language