Showing 347 of 1,158 total issues
File game_creator.js
has 840 lines of code (exceeds 250 allowed). Consider refactoring. Open
GameCreator = class GameCreator {
constructor(players, cards, exclusions, edition) {
this.card_id = 1
this.players = players
File card_list.js
has 803 lines of code (exceeds 250 allowed). Consider refactoring. Open
CardList = class CardList {
constructor(exclusions, edition) {
this.edition = edition
this.exclusions = exclusions
Function current_game
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
current_game() {
let game = Games.findOne({}, {
transform: function(game) {
game.kingdom_cards = []
game.common_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 find_gain_events
has 221 lines of code (exceeds 25 allowed). Consider refactoring. Open
find_gain_events() {
this.gain_events = []
if (this.gainer.player_cards._id === this.player_cards._id && _.includes(GainEventProcessor.event_cards(), this.gainer.gained_card.name)) {
if (this.gainer.gained_card.name === 'Duchy') {
`` has 59 functions (exceeds 20 allowed). Consider refactoring. Open
GameCreator = class GameCreator {
constructor(players, cards, exclusions, edition) {
this.card_id = 1
this.players = players
Function find_discard_events
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
find_discard_events() {
this.discard_events = []
if (_.includes(DiscardEventProcessor.event_cards(), this.card.name)) {
if (_.includes(['Tunnel', 'Faithful Hound', 'Village Green'], this.card.name) && this.discarder.game.turn.phase !== 'cleanup') {
this.discard_events.push(this.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
`` has 47 functions (exceeds 20 allowed). Consider refactoring. Open
CardList = class CardList {
constructor(exclusions, edition) {
this.edition = edition
this.exclusions = exclusions
File gain_event_processor.js
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
GainEventProcessor = class GainEventProcessor {
static reaction_cards() {
return [
'Black Cat',
Function find_gain_events
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
find_gain_events() {
this.gain_events = []
if (this.gainer.player_cards._id === this.player_cards._id && _.includes(GainEventProcessor.event_cards(), this.gainer.gained_card.name)) {
if (this.gainer.gained_card.name === 'Duchy') {
- 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 current_game
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
current_game() {
let game = Games.findOne({}, {
transform: function(game) {
game.kingdom_cards = []
game.common_cards = []
`` has 35 functions (exceeds 20 allowed). Consider refactoring. Open
TurnEnder = class TurnEnder {
constructor(game, player_cards) {
this.game = game
this.player_cards = player_cards
Function play
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
play(game, player_cards) {
let lantern = _.find(player_cards.artifacts, (artifact) => {
return artifact.name === 'Lantern'
})
- 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
File turn_ender.js
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
TurnEnder = class TurnEnder {
constructor(game, player_cards) {
this.game = game
this.player_cards = player_cards
Function update_phase
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
update_phase(free_play) {
if (!free_play) {
let phase
if (this.game.turn.phase === 'action' && _.includes(_.words(this.card.types), 'treasure')) {
phase = 'treasure'
- 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 find_buy_events
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
find_buy_events() {
this.buy_events = []
if (_.includes(BuyEventProcessor.event_cards(), this.buyer.card.name)) {
if (this.buyer.card.name === 'Messenger') {
if (_.size(this.buyer.game.turn.bought_things) === 1) {
Function create_player_cards
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
create_player_cards(player, index) {
let starting_treasures = []
if (this.game_has_card(this.selected_kingdom_cards, 'Pixie')) {
starting_treasures.push(new Goat())
}
Function find_discard_events
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
find_discard_events() {
this.discard_events = []
if (_.includes(DiscardEventProcessor.event_cards(), this.card.name)) {
if (_.includes(['Tunnel', 'Faithful Hound', 'Village Green'], this.card.name) && this.discarder.game.turn.phase !== 'cleanup') {
this.discard_events.push(this.card)
Function not_supply_cards
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
not_supply_cards() {
let not_supply_cards = []
let conditional_cards = [
{
card_name: 'Madman',
Function stack_size
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
stack_size(card) {
if (_.includes(_.words(card.types), 'victory')) {
return _.size(this.players) < 3 ? 8 : 12
} else if (_.includes(['Curse', 'Ruins'], card.name)) {
return _.size(this.players) === 1 ? 10 : _.size(this.players) * 10 - 10
- 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 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
play(game, player_cards) {
let lantern = _.find(player_cards.artifacts, (artifact) => {
return artifact.name === 'Lantern'
})