jcbantuelle/dominion-meteor

View on GitHub

Showing 1,158 of 1,158 total issues

Function attack has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  attack(game, player_cards, attacker_player_cards, card_player) {
    if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
      game.log.push(`&nbsp;&nbsp;<strong>${player_cards.username}</strong> has no cards in deck`)
    } else {
      let card_revealer = new CardRevealer(game, player_cards)
Severity: Minor
Found in app/cards/dark_ages/mixed_stack/knights.js - About 1 hr to fix

    Function attack has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      attack(game, player_cards) {
        if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
          game.log.push(`&nbsp;&nbsp;<strong>${player_cards.username}</strong> has no cards in deck`)
        } else {
          let card_revealer = new CardRevealer(game, player_cards)
    Severity: Minor
    Found in app/cards/menagerie/cardinal.js - About 1 hr to fix

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

          this.cards_to_discard = _.filter(this.player_cards.in_play, (card) => {
            return !ClassCreator.create(card.name).stay_in_play(this.game, this.player_cards, card)
          })
      Severity: Major
      Found in app/game/server/services/start_cleanup_event_processor.js and 1 other location - About 1 hr to fix
      app/game/server/services/turn_ender.js on lines 104..106

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

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

        point_variable(player_cards) {
          return _.size(_.filter(player_cards, function(card) {
            return _.includes(_.words(card.types), 'victory')
          }))
        }
      Severity: Major
      Found in app/cards/hinterlands/silk_road.js and 3 other locations - About 1 hr to fix
      app/cards/alchemy/vineyard.js on lines 19..23
      app/cards/empires/humble_castle.js on lines 20..24
      app/cards/empires/kings_castle.js on lines 11..15

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

      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

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

          let cards_to_discard = _.filter(this.player_cards.in_play, (card) => {
            return !ClassCreator.create(card.name).stay_in_play(this.game, this.player_cards, card)
          })
      Severity: Major
      Found in app/game/server/services/turn_ender.js and 1 other location - About 1 hr to fix
      app/game/server/services/start_cleanup_event_processor.js on lines 15..17

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

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

        point_variable(player_cards) {
          return _.size(_.filter(player_cards, function(card) {
            return _.includes(_.words(card.types), 'castle')
          }))
        }
      Severity: Major
      Found in app/cards/empires/humble_castle.js and 3 other locations - About 1 hr to fix
      app/cards/alchemy/vineyard.js on lines 19..23
      app/cards/empires/kings_castle.js on lines 11..15
      app/cards/hinterlands/silk_road.js on lines 15..19

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

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

        point_variable(player_cards) {
          return _.size(_.filter(player_cards, function(card) {
            return _.includes(_.words(card.types), 'castle')
          }))
        }
      Severity: Major
      Found in app/cards/empires/kings_castle.js and 3 other locations - About 1 hr to fix
      app/cards/alchemy/vineyard.js on lines 19..23
      app/cards/empires/humble_castle.js on lines 20..24
      app/cards/hinterlands/silk_road.js on lines 15..19

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

      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

        play(game, player_cards, card_player) {
          let coin_gainer = new CoinGainer(game, player_cards, card_player)
          coin_gainer.gain(2)
      
          let player_attacker = new PlayerAttacker(game, this, card_player)
      Severity: Major
      Found in app/cards/dark_ages/dame_sylvia.js and 1 other location - About 1 hr to fix
      app/cards/dark_ages/sir_destry.js on lines 11..17

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

      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

        play(game, player_cards, card_player) {
          let card_drawer = new CardDrawer(game, player_cards, card_player)
          card_drawer.draw(2)
      
          let player_attacker = new PlayerAttacker(game, this, card_player)
      Severity: Major
      Found in app/cards/dark_ages/sir_destry.js and 1 other location - About 1 hr to fix
      app/cards/dark_ages/dame_sylvia.js on lines 15..21

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

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

        point_variable(player_cards) {
          return _.size(_.filter(player_cards, function(card) {
            return _.includes(_.words(card.types), 'action')
          }))
        }
      Severity: Major
      Found in app/cards/alchemy/vineyard.js and 3 other locations - About 1 hr to fix
      app/cards/empires/humble_castle.js on lines 20..24
      app/cards/empires/kings_castle.js on lines 11..15
      app/cards/hinterlands/silk_road.js on lines 15..19

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

      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

        has_events() {
          return _.some(this.cards, (card) => {
            let trash_event_processor = new TrashEventProcessor(this, card)
            return !_.isEmpty(trash_event_processor.trash_events)
          })
      Severity: Major
      Found in app/game/server/services/card_trasher.js and 1 other location - About 1 hr to fix
      app/game/server/services/card_discarder.js on lines 46..51

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

      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

        trashable() {
          return this.trash_stack && this.trash_stack.count > 0 && this.trash_stack.top_card.name === this.card.name
        }
      Severity: Major
      Found in app/game/server/services/supply_card_trasher.js and 1 other location - About 1 hr to fix
      app/game/server/services/supply_card_exiler.js on lines 19..21

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

      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

        has_events() {
          return _.some(this.cards, (card) => {
            let discard_event_processor = new DiscardEventProcessor(this, card)
            return !_.isEmpty(discard_event_processor.discard_events)
          })
      Severity: Major
      Found in app/game/server/services/card_discarder.js and 1 other location - About 1 hr to fix
      app/game/server/services/card_trasher.js on lines 50..55

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

      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

        can_exile() {
          return this.exile_stack && this.exile_stack.count > 0 && this.exile_stack.top_card.name === this.card.name
        }
      Severity: Major
      Found in app/game/server/services/supply_card_exiler.js and 1 other location - About 1 hr to fix
      app/game/server/services/supply_card_trasher.js on lines 20..22

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

      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 play has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        play(game, player_cards, card_player) {
          let buy_gainer = new BuyGainer(game, player_cards)
          buy_gainer.gain(1)
      
          let coin_gainer = new CoinGainer(game, player_cards, card_player)
      Severity: Minor
      Found in app/cards/nocturne/sacred_grove.js - About 1 hr to fix

        Function process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          process() {
            if (!_.isEmpty(this.gain_events)) {
              let mandatory_gain_events = _.filter(this.gain_events, (event) => {
                return _.includes(GainEventProcessor.event_cards().concat(GainEventProcessor.in_play_event_cards()).concat(GainEventProcessor.reserve_cards()).concat(GainEventProcessor.landmark_cards()).concat(GainEventProcessor.duration_attack_cards()).concat(['Trade Route', 'Cargo Ship', 'Academy', 'Guildhall', 'Road Network', 'Innovation', 'Livery', 'Invest']), event.name)
              })
        Severity: Minor
        Found in app/game/server/services/gain_event_processor.js - About 1 hr to fix

          Function reveal has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            reveal(source, cards) {
              if (!cards) {
                cards = this.player_cards[source]
              } else if (!_.isArray(cards)) {
                cards = [cards]
          Severity: Minor
          Found in app/game/server/services/card_revealer.js - About 1 hr to fix

            Function set_up_extra_player_turns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              set_up_extra_player_turns() {
                let queued_turns = []
                if (this.game.turn.outpost) {
                  queued_turns.push(this.game.turn.outpost)
                }
            Severity: Minor
            Found in app/game/server/services/turn_ender.js - About 1 hr to fix

              Function process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                process() {
                  if (!_.isEmpty(this.buy_events)) {
                    let mandatory_buy_events = _.filter(this.buy_events, (event) => {
                      return _.includes(BuyEventProcessor.event_cards().concat(BuyEventProcessor.in_play_event_cards()).concat(BuyEventProcessor.overpay_cards()).concat(BuyEventProcessor.duration_attack_cards()).concat(BuyEventProcessor.landmark_cards()).concat(['Embargo', 'Charm', 'Tax']), event.name)
                    })
              Severity: Minor
              Found in app/game/server/services/buy_event_processor.js - About 1 hr to fix

                Function process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  process() {
                    if (!_.isEmpty(this.play_card_events)) {
                      let mandatory_play_card_events = _.filter(this.play_card_events, (event) => {
                        return event.name === 'Kiln'
                      })
                Severity: Minor
                Found in app/game/server/services/play_card_event_processor.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language