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',
Function adventures
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
static adventures() {
return [
'CoinOfTheRealm',
'Page',
'Peasant',
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
}
- 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 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,
- 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 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
})
- 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 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) {
- 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 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')
})
- 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 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()
- 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 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) {
- 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 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,
- 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 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')
})
- 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 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)
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) {
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)
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)
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)
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)
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(` <strong>${player_cards.username}</strong> has no cards in deck`)
} else {
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
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(` <strong>${player_cards.username}</strong> takes their -$1 token`)
player_cards.tokens.minus_coin = true
} else {