jcbantuelle/dominion-meteor

View on GitHub

Showing 1,158 of 1,158 total issues

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

  play(game, player_cards, card_player) {
    let card_drawer = new CardDrawer(game, player_cards, card_player)
    card_drawer.draw(3)

    let buy_gainer = new BuyGainer(game, player_cards)
Severity: Minor
Found in app/cards/nocturne/tragic_hero.js - About 1 hr to fix

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

      update_player_rankings() {
        if (_.size(this.game.players) === 2) {
          let usernames = _.map(this.game.players, 'username')
          let player_rankings = PlayerRankings.find({username: {$in: usernames}}).fetch()
          _.each(player_rankings, (player_ranking) => {
    Severity: Minor
    Found in app/game/server/services/game_ender.js - About 1 hr to fix

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

        play(game, player_cards, card_player) {
          let action_gainer = new ActionGainer(game, player_cards)
          action_gainer.gain(1)
      
          let trashable_cards = _.map(player_cards.hand, function(card) {
      Severity: Minor
      Found in app/cards/adventures/raze.js - About 1 hr to fix

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

          static overpay(game, player_cards, amount) {
            amount = Number(amount)
            if (amount > 0) {
              game.log.push(`&nbsp;&nbsp;<strong>${player_cards.username}</strong> overpays by $${amount}`)
              game.turn.coins -= amount
        Severity: Minor
        Found in app/cards/guilds/doctor.js - About 1 hr to fix

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

            between_turn_event(game, player_cards, mountain_pass) {
              game.log.push(`Bidding on ${CardView.render(mountain_pass)}`)
              GameModel.update(game._id, game)
          
              game.mountain_pass = {
          Severity: Minor
          Found in app/cards/empires/landmarks/mountain_pass.js - About 1 hr to fix

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

              play(game, player_cards, card_player) {
                let turn_event_id = TurnEventModel.insert({
                  game_id: game._id,
                  player_id: player_cards.player_id,
                  username: player_cards.username,
            Severity: Minor
            Found in app/cards/dark_ages/count.js - About 1 hr to fix

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

                play(game, player_cards, card_player) {
                  let coin_gainer = new CoinGainer(game, player_cards, card_player)
                  coin_gainer.gain(2)
              
                  if (_.size(player_cards.deck) > 0) {
              Severity: Minor
              Found in app/cards/dark_ages/scavenger.js - About 1 hr to fix

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

                  play(game, player_cards, card_player) {
                    let castles = _.filter(player_cards.hand, function(card) {
                      return _.includes(_.words(card.types), 'castle')
                    })
                    let trashable_cards = _.map(castles, function(card) {
                Severity: Minor
                Found in app/cards/empires/small_castle.js - About 1 hr to fix

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

                      let eligible_cards = _.filter(player_cards.hand, (card) => {
                        return _.includes(_.words(card.types), 'treasure') && card.name !== 'Cursed Gold'
                      })
                  Severity: Major
                  Found in app/cards/nocturne/pooka.js and 1 other location - About 1 hr to fix
                  app/cards/base/bandit.js on lines 29..31

                  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 (copy) {
                          let kiln = ClassCreator.create('Kiln').to_h()
                          kiln.id = this.generate_event_id()
                          this.play_card_events.push(kiln)
                        }
                  Severity: Major
                  Found in app/game/server/services/play_card_event_processor.js and 1 other location - About 1 hr to fix
                  app/game/server/services/gain_event_processor.js on lines 286..290

                  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

                    static discard_cards(game, player_cards, selected_cards) {
                      let card_discarder = new CardDiscarder(game, player_cards, 'revealed', selected_cards)
                      card_discarder.discard()
                  
                      let card_returner = new CardReturner(game, player_cards)
                  Severity: Major
                  Found in app/cards/hinterlands/cartographer.js and 1 other location - About 1 hr to fix
                  app/cards/seaside/lookout.js on lines 69..75

                  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 (_.size(replayable_actions) > 1) {
                          let turn_event_id = TurnEventModel.insert({
                            game_id: game._id,
                            player_id: player_cards.player_id,
                            username: player_cards.username,
                  Severity: Major
                  Found in app/cards/renaissance/scepter.js and 1 other location - About 1 hr to fix
                  app/cards/dark_ages/band_of_misfits.js on lines 19..36

                  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

                        let revealed_treasures = _.filter(player_cards.revealed, (card) => {
                          return _.includes(_.words(card.types), 'treasure') && card.name !== 'Copper'
                        })
                  Severity: Major
                  Found in app/cards/base/bandit.js and 1 other location - About 1 hr to fix
                  app/cards/nocturne/pooka.js on lines 12..14

                  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

                    static discard_card(game, player_cards, selected_cards) {
                      let card_discarder = new CardDiscarder(game, player_cards, 'revealed', selected_cards)
                      card_discarder.discard()
                  
                      let card_returner = new CardReturner(game, player_cards)
                  Severity: Major
                  Found in app/cards/seaside/lookout.js and 1 other location - About 1 hr to fix
                  app/cards/hinterlands/cartographer.js on lines 43..49

                  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 (investments) {
                          let invest = ClassCreator.create('Invest').to_h()
                          invest.id = this.generate_event_id()
                          this.gain_events.push(invest)
                        }
                  Severity: Major
                  Found in app/game/server/services/gain_event_processor.js and 1 other location - About 1 hr to fix
                  app/game/server/services/play_card_event_processor.js on lines 30..34

                  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

                  Consider simplifying this complex logical expression.
                  Open

                      if (_.includes(types, 'boon') || _.includes(types, 'state') || _.includes(types, 'hex') || _.includes(types, 'artifact') || _.includes(types, 'event') || _.includes(types, 'landmark') || _.includes(types, 'project') || _.includes(types, 'way')) {
                        width = 341
                        height = 220
                      }
                  Severity: Critical
                  Found in app/game/server/view_objects/card_view.js - About 1 hr to fix

                    Function event_cards has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static event_cards() {
                        return [
                          'Blessed Village',
                          'Border Village',
                          'Cache',
                    Severity: Minor
                    Found in app/game/server/services/gain_event_processor.js - About 1 hr to fix

                      Function stack_size has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        stack_size(card) {
                          if (_.includes(_.words(card.types), 'victory')) {
                            return _.size(this.players) < 3 ? 8 : 12
                          } else if (_.includes(['Curse', 'Ruins'], card.name)) {
                            return _.size(this.players) === 1 ? 10 : _.size(this.players) * 10 - 10
                      Severity: Minor
                      Found in app/lobby/server/game_creator.js - About 1 hr to fix

                        Function update_turn has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          update_turn() {
                            if (!this.black_market) {
                              this.game.turn.buys -= 1
                            }
                        
                        
                        Severity: Minor
                        Found in app/game/server/services/lib/card_buyer.js - About 1 hr to fix

                          Function play_twice has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            static play_twice(game, player_cards, selected_cards, procession) {
                              if (!_.isEmpty(selected_cards)) {
                                let selected_card = selected_cards[0]
                          
                                let card_player = new CardPlayer(game, player_cards, selected_card, procession)
                          Severity: Minor
                          Found in app/cards/dark_ages/procession.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language