engagementgamelab/CivicSeed

View on GitHub

Showing 258 of 421 total issues

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 -1;
    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

          Avoid too many return statements within this function.
          Open

                default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
          Severity: Major
          Found in client/code/system/backbone.js - About 30 mins to fix

            Function loadUsers has a Cognitive Complexity of 6 (exceeds 5 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: Minor
            Found in server/rpc/admin/startup.js - About 25 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 actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.actions = function (req, res, ss) {
              req.use('session')
              req.use('account.authenticated')
            
              return {
            Severity: Minor
            Found in server/rpc/admin/startup.js - About 25 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 getAndSetNetworkIp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              getAndSetNetworkIp: function (callback) {
                serverHelpers.getNetworkIPs(function (err, ips) {
                  if (err || !ips.length) {
                    config.set('IP', 'localhost')
                    winston.warn('CS:'.blue + ' Could not find network IP. Defaulting to \'localhost.\''.red)
            Severity: Minor
            Found in app/service.js - About 25 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 getGameRegion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              getGameRegion: function () {
                // Compare player position to centers of the world
                var position = this.getPosition()
                var posX = position.x
                var posY = position.y
            Severity: Minor
            Found in client/code/game/game.player.js - About 25 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 newBomb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              newBomb: function (bombed, id) {
                for (var b = 0; b < bombed.length; b += 1) {
                  // only add it to render list if it is on current screen
                  var loc = $map.masterToLocal(bombed[b].x, bombed[b].y)
                  var curTile = null
            Severity: Minor
            Found in client/code/game/game.map.js - About 25 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 loadSkinSuitImages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              loadSkinSuitImages: function (num) {
                if (num === undefined) num = 0
            
                var next = num + 1
                var skinsList = $game.$skins.getSetsList()
            Severity: Minor
            Found in client/code/game/game.render.js - About 25 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 loadVideo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              loadVideo: function (number) {
                var videoEl = document.createElement('video')
                var path = CivicSeed.CLOUD_PATH + '/audio/cutscenes/'
            
                if (CivicSeed.ENVIRONMENT === 'development') {
            Severity: Minor
            Found in client/code/game/game.boss.js - About 25 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 checkEnvironmentOnceFx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              checkEnvironmentOnceFx: function () {
                var numPlaces = _environmentOnceFxPlaces.length
                var p = 0
            
                while (p < numPlaces) {
            Severity: Minor
            Found in client/code/game/game.audio.js - About 25 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 forEachGridTile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              forEachGridTile: function (func) {
                var gridX = $game.VIEWPORT_WIDTH
                var gridY = $game.VIEWPORT_HEIGHT
            
                for (var x = 0; x < gridX; x++) {
            Severity: Minor
            Found in client/code/game/game.boss.js - About 25 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 checkEnvironmentLoopFx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              checkEnvironmentLoopFx: function () {
                var numPlaces = _environmentLoopFxPlaces.length
                var p = 0
            
                while (p < numPlaces) {
            Severity: Minor
            Found in client/code/game/game.audio.js - About 25 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 beginTransition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              beginTransition: function () {
                // Verify that the player is at the edge of a screen
                // Refuse transition if player is not at a transitional edge
                // This catches bugs
                var position = $game.$player.getLocalPosition()
            Severity: Minor
            Found in client/code/game/game.main.js - About 25 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 renderFrame has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              renderFrame: function () {
                // $game.$others.clear();
                // $game.$player.clear();
                // $game.$npc.clear();
                // $game.$botanist.clear();
            Severity: Minor
            Found in client/code/game/game.render.js - About 25 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              update: function () {
                var trackNum = whichTrack()
                var message = 'Entering '
            
                if (_soundtracks[trackNum]._loaded && trackNum !== _currentTrack && !_midTransition) {
            Severity: Minor
            Found in client/code/game/game.audio.js - About 25 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

            Severity
            Category
            Status
            Source
            Language