Showing 1,158 of 1,158 total issues
Function play
has 34 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(3)
let buy_gainer = new BuyGainer(game, player_cards)
Function update_player_rankings
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
update_player_rankings() {
if (_.size(this.game.players) === 2) {
let usernames = _.map(this.game.players, 'username')
let player_rankings = PlayerRankings.find({username: {$in: usernames}}).fetch()
_.each(player_rankings, (player_ranking) => {
Function play
has 34 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 trashable_cards = _.map(player_cards.hand, function(card) {
Function overpay
has 34 lines of code (exceeds 25 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
Function between_turn_event
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
between_turn_event(game, player_cards, mountain_pass) {
game.log.push(`Bidding on ${CardView.render(mountain_pass)}`)
GameModel.update(game._id, game)
game.mountain_pass = {
Function play
has 34 lines of code (exceeds 25 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,
Function play
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
play(game, player_cards, card_player) {
let coin_gainer = new CoinGainer(game, player_cards, card_player)
coin_gainer.gain(2)
if (_.size(player_cards.deck) > 0) {
Function play
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
play(game, player_cards, card_player) {
let castles = _.filter(player_cards.hand, function(card) {
return _.includes(_.words(card.types), 'castle')
})
let trashable_cards = _.map(castles, function(card) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
let eligible_cards = _.filter(player_cards.hand, (card) => {
return _.includes(_.words(card.types), 'treasure') && card.name !== 'Cursed Gold'
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (copy) {
let kiln = ClassCreator.create('Kiln').to_h()
kiln.id = this.generate_event_id()
this.play_card_events.push(kiln)
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
static discard_cards(game, player_cards, selected_cards) {
let card_discarder = new CardDiscarder(game, player_cards, 'revealed', selected_cards)
card_discarder.discard()
let card_returner = new CardReturner(game, player_cards)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (_.size(replayable_actions) > 1) {
let turn_event_id = TurnEventModel.insert({
game_id: game._id,
player_id: player_cards.player_id,
username: player_cards.username,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
let revealed_treasures = _.filter(player_cards.revealed, (card) => {
return _.includes(_.words(card.types), 'treasure') && card.name !== 'Copper'
})
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
static discard_card(game, player_cards, selected_cards) {
let card_discarder = new CardDiscarder(game, player_cards, 'revealed', selected_cards)
card_discarder.discard()
let card_returner = new CardReturner(game, player_cards)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (investments) {
let invest = ClassCreator.create('Invest').to_h()
invest.id = this.generate_event_id()
this.gain_events.push(invest)
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Consider simplifying this complex logical expression. Open
if (_.includes(types, 'boon') || _.includes(types, 'state') || _.includes(types, 'hex') || _.includes(types, 'artifact') || _.includes(types, 'event') || _.includes(types, 'landmark') || _.includes(types, 'project') || _.includes(types, 'way')) {
width = 341
height = 220
}
Function event_cards
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
static event_cards() {
return [
'Blessed Village',
'Border Village',
'Cache',
Function stack_size
has 33 lines of code (exceeds 25 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
Function update_turn
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
update_turn() {
if (!this.black_market) {
this.game.turn.buys -= 1
}
Function play_twice
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
static play_twice(game, player_cards, selected_cards, procession) {
if (!_.isEmpty(selected_cards)) {
let selected_card = selected_cards[0]
let card_player = new CardPlayer(game, player_cards, selected_card, procession)