jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

Function pay_tokens has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static pay_tokens(game, player_cards, amount, trashed_card) {
    amount = Number(amount)
    let coffer_text = amount === 1 ? 'Coffer' : 'Coffers'
    game.log.push(`&nbsp;&nbsp;<strong>${player_cards.username}</strong> removes ${amount} ${coffer_text}`)
    player_cards.coffers -= amount
Severity: Minor
Found in app/cards/guilds/butcher.js - About 1 hr to fix

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

      Function play has 26 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 card_trasher = new CardTrasher(game, player_cards, 'in_play', card_player.card)
      Severity: Minor
      Found in app/cards/seaside/embargo.js - About 1 hr to fix

        Function discard_cards has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static discard_cards(game, player_cards, selected_cards) {
            if (_.size(selected_cards) === 0) {
              game.log.push(`&nbsp;&nbsp;but does not discard anything`)
            } else {
              let card_discarder = new CardDiscarder(game, player_cards, 'hand', selected_cards)
        Severity: Minor
        Found in app/cards/adventures/artificer.js - About 1 hr to fix

          Function overpay has 26 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/herald.js - About 1 hr to fix

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

              play(game, player_cards) {
                let previous_player_query = new PreviousPlayerQuery(game, player_cards.player_id)
                let previous_player_cards = PlayerCardsModel.findOne(game._id, previous_player_query.previous_player()._id)
            
                let eligible_cards = _.filter(previous_player_cards.last_turn_gained_cards, function(gained_card) {
            Severity: Minor
            Found in app/cards/seaside/smugglers.js - About 1 hr to fix

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

                static trash_card(game, player_cards, selected_cards) {
                  if (!_.isEmpty(selected_cards)) {
                    let card_trasher = new CardTrasher(game, player_cards, 'hand', selected_cards[0])
                    card_trasher.trash()
              
              
              Severity: Minor
              Found in app/cards/base/mine.js - About 1 hr to fix

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

                  play(game, player_cards, card_player) {
                    let copper = _.find(player_cards.hand, (card) => {
                      return card.name === 'Copper'
                    })
                
                
                Severity: Minor
                Found in app/cards/base/moneylender.js - About 1 hr to fix

                  Function empires has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static empires() {
                      return [
                        'Engineer',
                        'CityQuarter',
                        'Overlord',
                  Severity: Minor
                  Found in app/cards/lib/card_list.js - About 1 hr to fix

                    Function start_turn_event has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      start_turn_event(game, player_cards, sinister_plot) {
                        game.log.push(`<strong>${player_cards.username}</strong> resolves ${CardView.render(sinister_plot)}`)
                    
                        let turn_event_id = TurnEventModel.insert({
                          game_id: game._id,
                    Severity: Minor
                    Found in app/cards/renaissance/projects/sinister_plot.js - About 1 hr to fix

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

                        gain(amount, announce = true) {
                          if (this.player_cards.player_id === this.game.turn.player._id) {
                            this.game.turn.buys += amount
                            if (announce) {
                              let buy_text = amount == 1 ? 'buy' : 'buys'
                      Severity: Minor
                      Found in app/game/server/services/buy_gainer.js - About 55 mins 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 draw has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        draw(to_draw_count, announce = true) {
                          if (this.card_player && this.card_player.chameleon) {
                            let coin_gainer = new CoinGainer(this.game, this.player_cards)
                            coin_gainer.gain(to_draw_count)
                          } else {
                      Severity: Minor
                      Found in app/game/server/services/card_drawer.js - About 55 mins 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 reveal has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 buyEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        buyEvent: function(card_name, 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 55 mins 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 buyProject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        buyProject: function(card_name, 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 55 mins 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 set_up_extra_player_turns has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 9 (exceeds 5 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 55 mins 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 update_log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        update_log() {
                          if (!this.buy) {
                            let player_username = this.player_cards.username
                            if (this.possessed_player_cards) {
                              player_username = this.possessed_player_cards.username
                      Severity: Minor
                      Found in app/game/server/services/card_gainer.js - About 55 mins 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 buyCard has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        buyCard: function(card_name, 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 55 mins 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 playDebtToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                        playDebtToken: function(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 55 mins 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