engagementgamelab/CivicSeed

View on GitHub
client/code/game/game.player.js

Summary

Maintainability
F
1 wk
Test Coverage

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

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

    var $player = module.exports = {
    
      firstName: null,
      id: null,
      game: null,
    Severity: Major
    Found in client/code/game/game.player.js - About 1 day to fix

      Function calculateSeeds has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

        calculateSeeds: function (options) {
          var tiles = []
      
          // Get the tiles that need to be bombed
          if (options.radius > 1) {
      Severity: Minor
      Found in client/code/game/game.player.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 drawSeed has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        drawSeed: function (pos) {
          if (_seeds.draw > 0) {
            var drawLocal = false
            if ($player.seedMode === 'draw') {
              var currentTile = $game.$map.currentTiles[pos.x][pos.y]
      Severity: Minor
      Found in client/code/game/game.player.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 displayNpcComments has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        displayNpcComments: function () {
          // Clear any previous comment bubbles
          $player.clearNpcComments()
      
          // Get on-screen NPCs
      Severity: Minor
      Found in client/code/game/game.player.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 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 _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 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 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 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

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

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

              init: function (callback) {
                // get the players info from the db, alerts other users of presence
                ss.rpc('game.player.init', function (playerInfo) {
                  // time in seconds since 1970 or whatever
                  _startTime = new Date().getTime() / 1000
            Severity: Minor
            Found in client/code/game/game.player.js - About 1 hr to fix

              Function drawSeed has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                drawSeed: function (pos) {
                  if (_seeds.draw > 0) {
                    var drawLocal = false
                    if ($player.seedMode === 'draw') {
                      var currentTile = $game.$map.currentTiles[pos.x][pos.y]
              Severity: Minor
              Found in client/code/game/game.player.js - About 1 hr to fix

                Function dropSeed has 43 lines of code (exceeds 25 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 1 hr to fix

                  Function sendSeedBomb has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    sendSeedBomb: function (data) {
                      var waitingEl = document.getElementById('waiting-for-seed')
                  
                      // set a waiting boolean so we don't plant more until receive data back from rpc
                      $game.flags.set('awaiting-seed')
                  Severity: Minor
                  Found in client/code/game/game.player.js - About 1 hr to fix

                    Function moveStraight has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      moveStraight: function (direction) {
                        var location
                        var targetPosition
                        var x, y
                    
                    
                    Severity: Minor
                    Found in client/code/game/game.player.js - About 1 hr to fix

                      Function beginMove has 38 lines of code (exceeds 25 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 1 hr to fix

                        Function saveResource has 35 lines of code (exceeds 25 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 1 hr to fix

                          Function beam has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            beam: function (location) {
                              $game.flags.set('is-beaming')
                              $game.flags.set('screen-transition')
                              $game.$input.resetUI()
                              $game.$chat.clearAllChats()
                          Severity: Minor
                          Found in client/code/game/game.player.js - About 1 hr to fix

                            Function resetInit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              resetInit: function () {
                                _curFrame = 0
                                _currentStepIncX = 0
                                _currentStepIncY = 0
                                _direction = 0
                            Severity: Minor
                            Found in client/code/game/game.player.js - About 1 hr to fix

                              Function moveStraight has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                moveStraight: function (direction) {
                                  var location
                                  var targetPosition
                                  var x, y
                              
                              
                              Severity: Minor
                              Found in client/code/game/game.player.js - About 1 hr 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 saveResourceLocally has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                saveResourceLocally: function (data) {
                                  var playerResource = _resources[data.id]
                              
                                  // See if the resource is already in the player's game data
                                  // If so, retrieve it and update it
                              Severity: Minor
                              Found in client/code/game/game.player.js - About 1 hr to fix

                                Function saveResourceLocally has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  saveResourceLocally: function (data) {
                                    var playerResource = _resources[data.id]
                                
                                    // See if the resource is already in the player's game data
                                    // If so, retrieve it and update it
                                Severity: Minor
                                Found in client/code/game/game.player.js - About 1 hr 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 _setPlayerInformation has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function _setPlayerInformation (info) {
                                  // Ensure that flags start from a clean state
                                  $game.flags.unsetAll()
                                
                                  // private
                                Severity: Minor
                                Found in client/code/game/game.player.js - About 1 hr to fix

                                  Function nextLevel has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    nextLevel: function () {
                                      $player.currentLevel += 1
                                      $player.seenRobot = false
                                      $game.$botanist.setState(0)
                                      $game.flags.unset('botanist-teleported')
                                  Severity: Minor
                                  Found in client/code/game/game.player.js - About 1 hr to fix

                                    Function saveOtherCommunityResources has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      saveOtherCommunityResources: function (answeredResourceId) {
                                        // Hack for community inventory items
                                        // Dummy data for other resources
                                        var ids = [4001, 4002, 4003]
                                        var bunchOfResources = []
                                    Severity: Minor
                                    Found in client/code/game/game.player.js - About 1 hr 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 too many return statements within this function.
                                      Open

                                          else return -1
                                      Severity: Major
                                      Found in client/code/game/game.player.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            else if (diffX < 0 && diffY > 0) return 3
                                        Severity: Major
                                        Found in client/code/game/game.player.js - About 30 mins to fix

                                          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

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

                                              return '#' + ('0' + (rgb.r.toString(16))).slice(-2) + ('0' + (rgb.g.toString(16))).slice(-2) + ('0' + (rgb.b.toString(16))).slice(-2)
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 3 hrs to fix
                                          client/code/game/game.others.js on lines 294..294

                                          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 95.

                                          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

                                                case 'down':
                                                  y = location.y
                                                  while ((y <= $game.VIEWPORT_HEIGHT - 1) && $game.$map.currentTiles[x][y].tileState === 0) {
                                                    targetPosition = { x: x, y: y }
                                                    y++
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 2 hrs to fix
                                          client/code/game/game.player.js on lines 278..284

                                          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 86.

                                          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

                                                case 'right':
                                                  x = location.x
                                                  while ((x <= $game.VIEWPORT_WIDTH - 1) && $game.$map.currentTiles[x][y].tileState === 0) {
                                                    targetPosition = { x: x, y: y }
                                                    x++
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 2 hrs to fix
                                          client/code/game/game.player.js on lines 264..270

                                          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 86.

                                          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

                                            makePrivate: function (id) {
                                              if (_resources[id]) {
                                                _resources[id].madePublic = false
                                                ss.rpc('game.npc.makeResponsePrivate', {
                                                  playerId: $player.id,
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 2 hrs to fix
                                          client/code/game/game.player.js on lines 536..546

                                          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 77.

                                          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

                                            makePublic: function (id) {
                                              if (_resources[id]) {
                                                _resources[id].madePublic = true
                                                ss.rpc('game.npc.makeResponsePublic', {
                                                  playerId: $player.id,
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 2 hrs to fix
                                          client/code/game/game.player.js on lines 549..559

                                          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 77.

                                          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

                                                  while (x >= 0 && $game.$map.currentTiles[x][y].tileState === 0) {
                                                    targetPosition = { x: x, y: y }
                                                    x--
                                                  }
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 1 hr to fix
                                          client/code/game/game.player.js on lines 259..262

                                          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 62.

                                          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

                                                  while (y >= 0 && $game.$map.currentTiles[x][y].tileState === 0) {
                                                    targetPosition = { x: x, y: y }
                                                    y--
                                                  }
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 1 hr to fix
                                          client/code/game/game.player.js on lines 273..276

                                          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 62.

                                          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

                                                  if ((targetPosition.x === 0 ||
                                                      targetPosition.x === $game.VIEWPORT_WIDTH - 1 ||
                                                      targetPosition.y === 0 ||
                                                      targetPosition.y === $game.VIEWPORT_HEIGHT - 1) &&
                                          Severity: Major
                                          Found in client/code/game/game.player.js and 1 other location - About 1 hr to fix
                                          client/code/game/game.main.js on lines 192..195

                                          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 61.

                                          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

                                          There are no issues that match your filters.

                                          Category
                                          Status