Showing 1,158 of 1,158 total issues
Function process_choice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static process_choice(game, player_cards, choice, card_player) {
if (choice[0] === 'cards') {
let card_drawer = new CardDrawer(game, player_cards, card_player)
card_drawer.draw(2)
} else if (choice[0] === 'coins') {
- Read upRead up
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) {
let selected_card = selected_cards[0]
let card_trasher = new CardTrasher(game, player_cards, 'hand', selected_cards)
card_trasher.trash()
- Read upRead up
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(3)
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
- Read upRead up
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 6 (exceeds 5 allowed). Consider refactoring. Open
buy(game, player_cards) {
let buy_gainer = new BuyGainer(game, player_cards)
buy_gainer.gain(1)
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
- Read upRead up
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 overpay
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static overpay(game, player_cards, amount) {
amount = Number(amount)
if (amount > 0) {
game.log.push(` <strong>${player_cards.username}</strong> overpays by $${amount}`)
game.turn.coins -= amount
- Read upRead up
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 6 (exceeds 5 allowed). Consider refactoring. Open
buy(game, player_cards) {
let card_gainer = new CardGainer(game, player_cards, 'discard', 'Curse')
let gained = card_gainer.gain()
if (gained && gained.name === 'Curse') {
- Read upRead up
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, attacker_player_cards, card_player) {
if (_.size(player_cards.deck) === 0 && _.size(player_cards.discard) === 0) {
game.log.push(` <strong>${player_cards.username}</strong> has no cards in deck`)
} else {
let card_revealer = new CardRevealer(game, player_cards)
- Read upRead up
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) {
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({
- Read upRead up
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)
- Read upRead up
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 discard_cards
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static discard_cards(game, player_cards, selected_cards, selection) {
let discard_count = _.size(selected_cards)
let card_discarder = new CardDiscarder(game, player_cards, 'hand', selected_cards)
card_discarder.discard()
- Read upRead up
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) {
let card_revealer = new CardRevealer(game, player_cards)
card_revealer.reveal_from_deck_until((game, player_cards, revealed_cards) => {
if (!_.isEmpty(revealed_cards)) {
return CardCostComparer.coin_greater_than(game, _.last(revealed_cards), 2)
- Read upRead up
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 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
- Read upRead up
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)
- Read upRead up
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()
- Read upRead up
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)
})
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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(` <strong>${player_cards.username}</strong> has no cards in deck`)
} else {
- Read upRead up
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"