jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

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

  buy(game, player_cards) {
    let unique_cards = _.uniqBy(player_cards.hand, 'name')

    var chosen_card
    if (_.size(unique_cards) > 1) {
Severity: Minor
Found in app/cards/menagerie/events/banish.js - About 1 hr to fix

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

      play(game, player_cards) {
        let card_mover = new CardMover(game, player_cards)
        let took_lost_in_the_woods = card_mover.take_unique_card('states', 'Lost In The Woods')
    
        if (took_lost_in_the_woods) {
    Severity: Minor
    Found in app/cards/nocturne/fool.js - About 1 hr to fix

      Function play has 48 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/nocturne/pixie.js - About 1 hr to fix

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

          static process_response(game, player_cards, response) {
            if (response[0] === 'gain') {
              let eligible_cards = _.filter(game.trash, (card) => {
                return CardCostComparer.coin_between(game, card, 3, 6)
              })
        Severity: Minor
        Found in app/cards/dark_ages/graverobber.js - About 1 hr to fix

          Function find_start_turn_events has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            find_start_turn_events() {
              this.start_turn_events = []
          
              _.each(this.player_cards.aside, (card) => {
                if (_.includes(StartTurnEventProcessor.aside_events(), card.name)) {
          Severity: Minor
          Found in app/game/server/services/start_turn_event_processor.js - About 1 hr to fix

            Function end_turn has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              end_turn() {
                this.game.previous_state = false
                if (this.game.turn.phase === 'action') {
                  this.start_buy_events()
                }
            Severity: Minor
            Found in app/game/server/services/turn_ender.js - About 1 hr to fix

              Function process_choice has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static process_choice(game, player_cards, choice) {
                  if (choice[0] === 'gain') {
                    let eligible_cards = _.filter(game.trash, (card) => {
                      return _.includes(_.words(card.types), 'action')
                    })
              Severity: Minor
              Found in app/cards/intrigue/lurker.js - About 1 hr to fix

                Function play has 46 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/menagerie/ways/way_of_the_butterfly.js - About 1 hr to fix

                  Function play has 46 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(1)
                  
                      let victory_token_gainer = new VictoryTokenGainer(game, player_cards)
                  Severity: Minor
                  Found in app/cards/prosperity/bishop.js - About 1 hr to fix

                    Function play has 45 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)
                    
                        let black_market_card_buyer = new BlackMarketCardBuyer(game, player_cards)
                    Severity: Minor
                    Found in app/cards/promo/black_market.js - About 1 hr to fix

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

                        play(game, player_cards) {
                          let eligible_cards = _.filter(player_cards.hand, function(card) {
                            return _.includes(_.words(card.types), 'treasure')
                          })
                          if (_.size(eligible_cards) > 0) {
                      Severity: Minor
                      Found in app/cards/guilds/taxman.js - About 1 hr to fix

                        Function gain_event has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          static gain_event(game, player_cards, selected_cards, gain_event_processor) {
                            if (!_.isEmpty(selected_cards)) {
                              let card = selected_cards[0]
                              if (card.name === 'Exile') {
                                let exiled_copies = _.filter(player_cards.exile, (card) => {
                        Severity: Minor
                        Found in app/game/server/services/gain_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 playCard has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          playCard: function(card_id, game_id) {
                            Future.task(Meteor.bindEnvironment(function() {
                              if (!ActionLock[game_id]) {
                                ActionLock[game_id] = true
                                let current_game = game(game_id)
                        Severity: Minor
                        Found in app/game/server/game.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 receive has a Cognitive Complexity of 14 (exceeds 5 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

                        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 process_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          static process_response(game, player_cards, response) {
                            response = response[0]
                            if (response === 'attack') {
                              let attacks = _.filter(player_cards.hand, function(card) {
                                return _.includes(_.words(card.types), 'attack')
                        Severity: Minor
                        Found in app/cards/adventures/events/quest.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 process_response has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          static process_response(game, player_cards, response, card_player) {
                            if (response[0] === 'discard') {
                              if (_.size(player_cards.hand) > 2) {
                                let turn_event_id = TurnEventModel.insert({
                                  game_id: game._id,
                        Severity: Minor
                        Found in app/cards/dark_ages/count.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 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          play(game, player_cards, card_player) {
                            if (_.size(game.hexes_deck) === 0) {
                              game.hexes_deck = _.shuffle(game.hexes_discard)
                              game.hexes_discard = []
                            }
                        Severity: Minor
                        Found in app/cards/nocturne/vampire.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 43 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/renaissance/scepter.js - About 1 hr to fix

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

                            play(game, player_cards) {
                              let eligible_trash_cards = this.trashable_cards(player_cards.hand, 'H').concat(this.trashable_cards(player_cards.discard, 'D'))
                          
                              if (_.size(eligible_trash_cards) > 0) {
                                let turn_event_id = TurnEventModel.insert({
                          Severity: Minor
                          Found in app/cards/dark_ages/hermit.js - About 1 hr to fix

                            Function play has 42 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/base/sentry.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language