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) {
- 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 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,
- 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 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) {
- 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
Avoid too many return
statements within this function. Open
return 16
Avoid too many return
statements within this function. Open
return 10
Avoid too many return
statements within this function. Open
return 13
Avoid too many return
statements within this function. Open
return 6
Avoid too many return
statements within this function. Open
return 20
Avoid too many return
statements within this function. Open
return this.selection
Avoid too many return
statements within this function. Open
return 15
Avoid too many return
statements within this function. Open
return 12
Avoid too many return
statements within this function. Open
return 5
Avoid too many return
statements within this function. Open
return 30
Avoid too many return
statements within this function. Open
return '-2'
Avoid too many return
statements within this function. Open
return 'T'
Avoid too many return
statements within this function. Open
return 12
Avoid too many return
statements within this function. Open
return 12
Avoid too many return
statements within this function. Open
return 12
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
})
- 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 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)
- 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"