jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

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

  buy(game, player_cards) {
    let buy_gainer = new BuyGainer(game, player_cards)
    buy_gainer.gain(1)

    if (_.size(player_cards.deck) > 0 || _.size(player_cards.discard) > 0) {
Severity: Minor
Found in app/cards/menagerie/events/pursue.js - About 1 hr to fix

    Function play has 41 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(2)
    
        GameModel.update(game._id, game)
    Severity: Minor
    Found in app/cards/prosperity/vault.js - About 1 hr to fix

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

        play(game, player_cards) {
          if (_.size(player_cards.hand) > 1) {
            let turn_event_id = TurnEventModel.insert({
              game_id: game._id,
              player_id: player_cards.player_id,
      Severity: Minor
      Found in app/cards/dark_ages/altar.js - About 1 hr to fix

        Function play has 41 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 trashed_cards = []
        Severity: Minor
        Found in app/cards/renaissance/research.js - About 1 hr to fix

          Function receive has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            receive(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/hexes/locusts.js - About 1 hr to fix

            Function play has 40 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/cornucopia/hamlet.js - About 1 hr to fix

              Function play has 40 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;but there are no cards in their deck`)
                  } else {
                    let card_revealer = new CardRevealer(game, player_cards)
              Severity: Minor
              Found in app/cards/alchemy/golem.js - About 1 hr to fix

                Function play_card has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  play_card(announce, free_play) {
                    let play_result
                    this.token_effects()
                    if (_.includes(_.words(this.card.types), 'action') && this.game.turn.player._id === this.player_cards.player_id) {
                      this.game.turn.played_actions.push(this.card)
                Severity: Minor
                Found in app/game/server/services/card_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 attack has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  attack(game, player_cards, attacker) {
                    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/cornucopia/jester.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 find_buy_events has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  find_buy_events() {
                    this.buy_events = []
                    if (_.includes(BuyEventProcessor.event_cards(), this.buyer.card.name)) {
                      if (this.buyer.card.name === 'Messenger') {
                        if (_.size(this.buyer.game.turn.bought_things) === 1) {
                Severity: Minor
                Found in app/game/server/services/buy_event_processor.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 create_player_cards has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  create_player_cards(player, index) {
                    let starting_treasures = []
                    if (this.game_has_card(this.selected_kingdom_cards, 'Pixie')) {
                      starting_treasures.push(new Goat())
                    }
                Severity: Minor
                Found in app/lobby/server/game_creator.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 attack has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  attack(game, player_cards, attacker_player_cards, card_player, trashed_card) {
                    if (trashed_card) {
                
                      if (CardCostComparer.coin_greater_than(game, trashed_card, 2)) {
                        let card_gainer = new CardGainer(game, player_cards, 'discard', 'Curse')
                Severity: Minor
                Found in app/cards/empires/catapult.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 play has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  play(game, player_cards, card_player) {
                    let action_gainer = new ActionGainer(game, player_cards)
                    action_gainer.gain(1)
                
                    let trashed_cards = []
                Severity: Minor
                Found in app/cards/renaissance/research.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 attack has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  attack(game, player_cards, attacker) {
                    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/cornucopia/jester.js - About 1 hr to fix

                  Function attack has 39 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_until((game, player_cards, revealed_cards) => {
                        if (!_.isEmpty(revealed_cards)) {
                          return CardCostComparer.coin_greater_than(game, _.last(revealed_cards), 2)
                  Severity: Minor
                  Found in app/cards/intrigue/saboteur.js - About 1 hr to fix

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

                      play(game, player_cards) {
                        let eligible_cards = _.filter(game.cards, (card) => {
                          return card.count > 0 && card.supply && CardCostComparer.coin_less_than(game, card.top_card, 6)
                        })
                    
                    
                    Severity: Minor
                    Found in app/cards/base/artisan.js - About 1 hr to fix

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

                        play(game, player_cards, card_player) {
                          if (_.size(player_cards.hand) > 0) {
                            let turn_event_id = TurnEventModel.insert({
                              game_id: game._id,
                              player_id: player_cards.player_id,
                      Severity: Minor
                      Found in app/cards/nocturne/bat.js - About 1 hr to fix

                        Function create_game has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          create_game() {
                            let cards = this.game_cards()
                            let game_attributes = {
                              players: _.shuffle(this.players),
                              cards: cards,
                        Severity: Minor
                        Found in app/lobby/server/game_creator.js - About 1 hr to fix

                          Function play has 38 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(2)
                          
                              if (_.size(player_cards.hand) > 0) {
                          Severity: Minor
                          Found in app/cards/adventures/gear.js - About 1 hr to fix

                            Function potion_overpay has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              static potion_overpay(game, player_cards, amount, coin_overpay) {
                                let potion_overpay = Number(amount)
                                if (coin_overpay === 0 && potion_overpay === 0) {
                                  game.log.push(`&nbsp;&nbsp;but does not overpay`)
                                } else {
                            Severity: Minor
                            Found in app/cards/guilds/stonemason.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language