jcbantuelle/dominion-meteor

View on GitHub

Showing 1,158 of 1,158 total issues

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

  attack(game, player_cards) {
    let card_revealer = new CardRevealer(game, player_cards)
    card_revealer.reveal_from_deck(2)

    GameModel.update(game._id, game)
Severity: Minor
Found in app/cards/hinterlands/noble_brigand.js - About 1 hr to fix

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

      static process_response(game, player_cards, response, card_player) {
        let ordered_player_cards = TurnOrderedPlayerCardsQuery.turn_ordered_player_cards(game, player_cards)
    
        _.each(ordered_player_cards, function(current_player_cards) {
          let is_active_player = current_player_cards.player_id === player_cards.player_id
    Severity: Minor
    Found in app/cards/promo/governor.js - About 1 hr to fix

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

        static add_treasure(card) {
          let card_types = _.words(card.types)
          card_types.push('treasure')
          card.types = card_types.join(' ')
          return card
      Severity: Major
      Found in app/cards/renaissance/projects/capitalism.js and 1 other location - About 1 hr to fix
      app/cards/adventures/events/inheritance.js on lines 76..81

      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

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

          } else if (effect === 'hex') {
            this.effect_deck = this.game.hexes_deck
            this.effect_discard = this.game.hexes_discard
            this.player_effects = this.player_cards.hexes
          }
      Severity: Major
      Found in app/game/server/services/effect_receiver.js and 1 other location - About 1 hr to fix
      app/game/server/services/effect_receiver.js on lines 6..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 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

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

        static add_action(card) {
          let card_types = _.words(card.types)
          card_types.push('action')
          card.types = card_types.join(' ')
          return card
      Severity: Major
      Found in app/cards/adventures/events/inheritance.js and 1 other location - About 1 hr to fix
      app/cards/renaissance/projects/capitalism.js on lines 47..52

      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

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

          if (effect === 'boon') {
            this.effect_deck = this.game.boons_deck
            this.effect_discard = this.game.boons_discard
            this.player_effects = this.player_cards.boons
          } else if (effect === 'hex') {
      Severity: Major
      Found in app/game/server/services/effect_receiver.js and 1 other location - About 1 hr to fix
      app/game/server/services/effect_receiver.js on lines 10..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 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

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

        put_card_in_discard(card) {
          if (!card.destination) {
            card.destination = 'discard'
          }
      
      
      Severity: Minor
      Found in app/game/server/services/card_discarder.js - About 1 hr to fix

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

          play(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 {
              if (_.size(player_cards.deck) === 0) {
        Severity: Minor
        Found in app/cards/nocturne/zombie_mason.js - About 1 hr to fix

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

            find_trash_events() {
              this.trash_events = []
              if (_.includes(TrashEventProcessor.event_cards(), this.card.name)) {
                this.trash_events.push(this.card)
              }
          Severity: Minor
          Found in app/game/server/services/trash_event_processor.js - About 1 hr to fix

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

              play(game, player_cards, card_player) {
                let eligible_cards = _.filter(player_cards.in_play, function(card) {
                  return _.includes(_.words(card.types), 'treasure')
                })
            
            
            Severity: Minor
            Found in app/cards/nocturne/crypt.js - About 1 hr to fix

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

                static reveal_card(game, player_cards, selected_cards, card_player) {
                  let card_revealer = new CardRevealer(game, player_cards)
                  card_revealer.reveal('hand', selected_cards[0])
              
                  let next_player_query = new NextPlayerQuery(game, player_cards.player_id)
              Severity: Minor
              Found in app/cards/empires/gladiator.js - About 1 hr to fix

                Function play has 32 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(1)
                
                    let action_gainer = new ActionGainer(game, player_cards)
                Severity: Minor
                Found in app/cards/intrigue/mining_village.js - About 1 hr to fix

                  Function attack has 32 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 {
                        if (_.size(player_cards.deck) === 0) {
                  Severity: Minor
                  Found in app/cards/intrigue/swindler.js - About 1 hr to fix

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

                      play(game, player_cards, card_player) {
                        let eligible_cards = _.chain(player_cards.hand).filter((card) => {
                          return _.includes(_.words(card.types), 'action')
                        }).map((card) => {
                          let trashable_card = _.clone(card)
                    Severity: Minor
                    Found in app/cards/dark_ages/death_cart.js - About 1 hr to fix

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

                        static trash_card(game, player_cards, selected_cards) {
                          let trashed_card = selected_cards[0]
                          let source = trashed_card.source === 'H' ? 'hand' : 'in_play'
                          let card_trasher = new CardTrasher(game, player_cards, source, trashed_card)
                          card_trasher.trash()
                      Severity: Minor
                      Found in app/cards/adventures/raze.js - About 1 hr to fix

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

                          attack(game, player_cards) {
                            if (game.turn.rogue_attack) {
                              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 {
                        Severity: Minor
                        Found in app/cards/dark_ages/rogue.js - About 1 hr to fix

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

                            static reveal_card(game, player_cards, selected_cards) {
                              game.turn.ambassador_selected_card = selected_cards[0]
                              game.turn.ambassador_game_stack = _.find(game.cards, function(card) {
                                return card.name === game.turn.ambassador_selected_card.stack_name && card.supply
                              })
                          Severity: Minor
                          Found in app/cards/seaside/ambassador.js - About 1 hr to fix

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

                              static menagerie() {
                                return [
                                  'BlackCat',
                                  'Sleigh',
                                  'Supplies',
                            Severity: Minor
                            Found in app/cards/lib/card_list.js - About 1 hr to fix

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

                                static adventures() {
                                  return [
                                    'CoinOfTheRealm',
                                    'Page',
                                    'Peasant',
                              Severity: Minor
                              Found in app/cards/lib/card_list.js - About 1 hr to fix

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

                                  gain(amount, announce = true) {
                                    if (this.player_cards.player_id === this.game.turn.player._id) {
                                      if (this.game.turn.no_more_actions) {
                                        amount = 0
                                      }
                                Severity: Minor
                                Found in app/game/server/services/action_gainer.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

                                Severity
                                Category
                                Status
                                Source
                                Language