engagementgamelab/CivicSeed

View on GitHub

Showing 421 of 421 total issues

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

console.log('  _'.white + '|"""""|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""| {======|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""|'.green + '_'.white + '|"""""| '.green)
Severity: Major
Found in bin/server.js and 1 other location - About 5 hrs to fix
bin/server.js on lines 45..45

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

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

console.log('  '.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\'./'.green + 'o--000'.white + '\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\''.green + '"'.white + '`-'.green + '0'.white + '-'.green + '0'.white + '-\' '.green)
Severity: Major
Found in bin/server.js and 1 other location - About 5 hrs to fix
bin/server.js on lines 44..44

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

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

      $body.on('click', '.private-button button', function () {
        $game.$player.makePrivate($(this).attr('data-resource'))
        // Toggle state of button
        // TODO: place this presentation logic elsewhere
        // This toggling does not reflect success / error conditions from server
Severity: Major
Found in client/code/game/game.input.js and 1 other location - About 5 hrs to fix
client/code/game/game.input.js on lines 368..376

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

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

      $body.on('click', '.public-button button', function () {
        $game.$player.makePublic($(this).attr('data-resource'))
        // Toggle state of button
        // TODO: place this presentation logic elsewhere
        // This toggling does not reflect success / error conditions from server
Severity: Major
Found in client/code/game/game.input.js and 1 other location - About 5 hrs to fix
client/code/game/game.input.js on lines 379..387

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

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 3 locations. Consider refactoring.
Open

    if (tileData.b3 > -1) {
      srcX = tileData.b3 % _tilesheetWidth
      srcY = Math.floor(tileData.b3 / _tilesheetWidth)
      // draw it to offscreen
      _backgroundContext.drawImage(
Severity: Major
Found in client/code/game/game.render.js and 2 other locations - About 5 hrs to fix
client/code/game/game.render.js on lines 456..472
client/code/game/game.render.js on lines 474..489

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

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 3 locations. Consider refactoring.
Open

    if (tileData.b1 > -1) {
      srcX = tileData.b1 % _tilesheetWidth
      srcY = Math.floor(tileData.b1 / _tilesheetWidth)

      // draw it to offscreen
Severity: Major
Found in client/code/game/game.render.js and 2 other locations - About 5 hrs to fix
client/code/game/game.render.js on lines 474..489
client/code/game/game.render.js on lines 491..506

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

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 3 locations. Consider refactoring.
Open

    if (tileData.b2 > -1) {
      srcX = tileData.b2 % _tilesheetWidth
      srcY = Math.floor(tileData.b2 / _tilesheetWidth)
      // draw it to offscreen
      _backgroundContext.drawImage(
Severity: Major
Found in client/code/game/game.render.js and 2 other locations - About 5 hrs to fix
client/code/game/game.render.js on lines 456..472
client/code/game/game.render.js on lines 491..506

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

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 (tileData.f2 > -1) {
      srcX = tileData.f2 % _tilesheetWidth
      srcY = Math.floor(tileData.f2 / _tilesheetWidth)
      _foregroundContext.drawImage(
        _tilesheetCanvas[tilesheetIndex],
Severity: Major
Found in client/code/game/game.render.js and 1 other location - About 4 hrs to fix
client/code/game/game.render.js on lines 514..528

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

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 (tileData.f1 > -1) {
      srcX = tileData.f1 % _tilesheetWidth
      srcY = Math.floor(tileData.f1 / _tilesheetWidth)
      _foregroundContext.drawImage(
        _tilesheetCanvas[tilesheetIndex],
Severity: Major
Found in client/code/game/game.render.js and 1 other location - About 4 hrs to fix
client/code/game/game.render.js on lines 529..543

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

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

Function exports has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (function () {
  return {
    ready: false,

    // load in other players
Severity: Major
Found in client/code/game/game.others.js - About 4 hrs to fix

    Function exports has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = (function () {
      // Placeholder for chat display time, after which a setTimeout is used to hide the chat bubble.
      var displayTimer = null
    
      var badWords = ['fuck', 'shit', 'bitch', 'cunt', 'damn', 'penis', 'vagina', 'crap', 'screw', 'suck', 'piss', 'whore', 'slut']
    Severity: Minor
    Found in client/code/game/game.chat.js - About 4 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 init has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function init () {
      var $body = $(document.body)
    
      // Intercept default browser button actions
      $('button').on('click', function (e) {
    Severity: Major
    Found in client/code/admin/npcs.js - About 4 hrs to fix

      Function transitionMap has a Cognitive Complexity of 32 (exceeds 5 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: Minor
      Found in client/code/game/game.map.js - About 4 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 actions has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.actions = function (req, res, ss) {
        req.use('session')
      
        var gameModel = ss.service.db.model('Game')
        var npcModel = ss.service.db.model('Npc')
      Severity: Major
      Found in server/rpc/admin/monitor.js - About 4 hrs to fix

        Function actions has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.actions = function (req, res, ss) {
          req.use('session')
        
          var UserModel = ss.service.db.model('User')
          var GameModel = ss.service.db.model('Game')
        Severity: Major
        Found in server/rpc/shared/profiles.js - About 4 hrs to fix

          Function makeResumeFormHTML has 114 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            makeResumeFormHTML: function (resource) {
              var html = ''
          
              // Notes on questions and desired functionality from Sam's Google Doc
              switch (resource.answer) {
          Severity: Major
          Found in client/code/game/game.resources.js - About 4 hrs to fix

            Function actions has 111 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.actions = function (req, res, ss) {
              req.use('session')
            
              var Npc = ss.service.db.model('Npc')
              var Game = ss.service.db.model('Game')
            Severity: Major
            Found in server/rpc/game/npc.js - About 4 hrs to fix

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

              'use strict'
              /* global ss, $, $game */
              
              /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
              
              
              Severity: Minor
              Found in client/code/game/game.others.js - About 4 hrs to fix

                Function exports has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = (function () {
                  var _inventory = {} // Holds each item in inventory.
                
                  // Returns true if a resource is held in the player's inventory
                  function isInInventory (item) {
                Severity: Major
                Found in client/code/game/game.inventory.js - About 4 hrs to fix

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

                  'use strict'
                  /* global ss, $, $game */
                  
                  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
                  
                  
                  Severity: Minor
                  Found in client/code/game/game.npc.js - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language