jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

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

      Function play has a Cognitive Complexity of 11 (exceeds 5 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

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

        gain_event(gainer, aqueduct) {
          if (_.includes(_.words(gainer.gained_card.types), 'treasure')) {
            let gained_card_stack = _.find(gainer.game.cards, (card) => {
              return card.stack_name === gainer.gained_card.stack_name
            })
      Severity: Minor
      Found in app/cards/empires/landmarks/aqueduct.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 11 (exceeds 5 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

      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_choice has a Cognitive Complexity of 11 (exceeds 5 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

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

        static draw_cards(game, player_cards) {
          if (_.size(player_cards.hand) >= 7 || (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0)) {
            if (_.size(player_cards.aside) > 0) {
              let card_discarder = new CardDiscarder(game, player_cards, 'aside')
              card_discarder.discard()
      Severity: Minor
      Found in app/cards/base/library.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 11 (exceeds 5 allowed). Consider refactoring.
      Open

        play(game, player_cards) {
          if (_.size(player_cards.hand) >= 7) {
            game.log.push(`  but ${player_cards.username} already has 7 cards in hand`)
          } else {
            if (player_cards.tokens.minus_card) {
      Severity: Minor
      Found in app/cards/base/library.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 buy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        buy(game, player_cards) {
          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/events/transport.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 buy has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        buy(game, player_cards) {
          let eligible_cards = _.filter(player_cards.hand, (card) => {
            return !_.includes(_.words(card.types), 'victory')
          })
      
      
      Severity: Minor
      Found in app/cards/menagerie/events/enhance.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        play(free_play = false, move_card = true, source = 'hand', number_of_times = 1, announce = true) {
          let duration = false
          _.times(number_of_times, (play_count) => {
            if (this.can_play(free_play)) {
              this.update_phase(free_play)
      Severity: Minor
      Found in app/game/server/services/card_player.js - About 1 hr to fix

        Function play has 31 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 victory_cards = _.filter(player_cards.hand, function(card) {
        Severity: Minor
        Found in app/cards/nocturne/shepherd.js - About 1 hr to fix

          Function play has 31 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 card_mover = new CardMover(game, player_cards)
          Severity: Minor
          Found in app/cards/nocturne/wish.js - About 1 hr to fix

            Function play has 31 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 buy_gainer = new BuyGainer(game, player_cards)
            Severity: Minor
            Found in app/cards/dark_ages/forager.js - About 1 hr to fix

              Function play has 31 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/poacher.js - About 1 hr to fix

                Function play has 31 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/dark_ages/rats.js - About 1 hr to fix

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

                    attack(game, player_cards) {
                      if (game.turn.pirate_ship_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/seaside/pirate_ship.js - About 1 hr to fix

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

                      static trash_card(game, player_cards, selected_cards) {
                        if (!_.isEmpty(selected_cards)) {
                          let is_active_player = game.turn.player._id === player_cards.player_id
                          let remodel_amount = is_active_player ? 2 : 1
                    
                    
                    Severity: Minor
                    Found in app/cards/promo/governor.js - About 1 hr to fix

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

                        buy(game, player_cards) {
                          if (!player_cards.tokens.minus_coin) {
                            game.log.push(`&nbsp;&nbsp;<strong>${player_cards.username}</strong> takes their -$1 token`)
                            player_cards.tokens.minus_coin = true
                          } else {
                      Severity: Minor
                      Found in app/cards/adventures/events/ball.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language