jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

Function play has a Cognitive Complexity of 7 (exceeds 5 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 35 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 7 (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/renaissance/scepter.js - About 35 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 buy has a Cognitive Complexity of 7 (exceeds 5 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 35 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

Avoid too many return statements within this function.
Open

      return 16
Severity: Major
Found in app/lobby/server/game_creator.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return 10
    Severity: Major
    Found in app/lobby/server/game_creator.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return 13
      Severity: Major
      Found in app/lobby/server/game_creator.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return 6
        Severity: Major
        Found in app/lobby/server/game_creator.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return 20
          Severity: Major
          Found in app/lobby/server/game_creator.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.selection
            Severity: Major
            Found in app/game/client/value_objects/turn_event_submission.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return 15
              Severity: Major
              Found in app/lobby/server/game_creator.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return 12
                Severity: Major
                Found in app/lobby/server/game_creator.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return 5
                  Severity: Major
                  Found in app/lobby/server/game_creator.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return 30
                    Severity: Major
                    Found in app/lobby/server/game_creator.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return '-2'
                      Severity: Major
                      Found in app/game/server/services/token_placer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return 'T'
                        Severity: Major
                        Found in app/game/server/services/token_placer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return 12
                          Severity: Major
                          Found in app/lobby/server/game_creator.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return 12
                            Severity: Major
                            Found in app/lobby/server/game_creator.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return 12
                              Severity: Major
                              Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                Function find_card_to_gain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  find_card_to_gain() {
                                    if (this.source === 'supply') {
                                      this.supply_pile = _.find(this.game.cards, (card) => {
                                        return card.name === this.card_name || card.top_card.name === this.card_name
                                      })
                                Severity: Minor
                                Found in app/game/server/services/card_gainer.js - About 25 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 turn_over has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function turn_over(game, player_cards) {
                                  if (game.turn.phase === 'buy') {
                                    return game.turn.buys === 0 && (player_cards.debt_tokens === 0 || game.turn.coins === 0) && !has_night_cards(player_cards)
                                  } else if (game.turn.phase === 'night') {
                                    return !has_night_cards(player_cards)
                                Severity: Minor
                                Found in app/game/server/game.js - About 25 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