jcbantuelle/dominion-meteor

View on GitHub

Showing 347 of 1,158 total issues

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

  buy(game, player_cards) {
    game.turn.forbidden_events.push(this.name())

    let curse = _.find(game.cards, (card) => {
      return card.name === 'Curse' && card.count > 0
Severity: Minor
Found in app/cards/menagerie/events/desperation.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 play has a Cognitive Complexity of 6 (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(1)

    let action_gainer = new ActionGainer(game, player_cards)
Severity: Minor
Found in app/cards/guilds/herald.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 trash_card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static trash_card(game, player_cards, selected_cards, card_player) {
    if (!_.isEmpty(selected_cards)) {
      let source = selected_cards[0].source === 'H' ? 'hand' : 'in_play'
      let card_trasher = new CardTrasher(game, player_cards, source, selected_cards)
      let trashed_cards = card_trasher.trash()
Severity: Minor
Found in app/cards/dark_ages/death_cart.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 attack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  attack(game, player_cards) {
    if (_.size(player_cards.hand) > 4) {
      let eligible_cards = _.filter(player_cards.hand, function (card) {
        return CardCostComparer.coin_greater_than(game, card, 1)
      })
Severity: Minor
Found in app/cards/renaissance/villain.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 trash_card has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static trash_card(game, player_cards, selected_cards, improve) {
    if (_.size(selected_cards) > 0) {
      game.log.push(`<strong>${player_cards.username}</strong> resolves ${CardView.render(improve)}`)
      let eligible_cards = _.filter(game.cards, (card) => {
        return card.count > 0 && card.supply  && CardCostComparer.card_equal_to(game, selected_cards[0], card.top_card, 1)
Severity: Minor
Found in app/cards/renaissance/improve.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 pull_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  pull_set() {
    let game_cards = _.sampleSize(this.cards, 10)

    let aside_cards = _.filter(game_cards, (card_name) => {
      return _.includes(CardList.aside_cards(this.exclusions, this.edition), card_name)
Severity: Minor
Found in app/cards/lib/card_list.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 start_turn_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  start_turn_event(game, player_cards, piazza) {
    game.log.push(`<strong>${player_cards.username}</strong> resolves ${CardView.render(piazza)}`)
    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/renaissance/projects/piazza.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