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
- 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"