jcbantuelle/dominion-meteor

View on GitHub
app/lobby/server/game_creator.js

Summary

Maintainability
F
1 wk
Test Coverage

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
Severity: Major
Found in app/lobby/server/game_creator.js - About 2 days to fix

    `` has 59 functions (exceeds 20 allowed). Consider refactoring.
    Open

    GameCreator = class GameCreator {
    
      constructor(players, cards, exclusions, edition) {
        this.card_id = 1
        this.players = players
    Severity: Major
    Found in app/lobby/server/game_creator.js - About 1 day to fix

      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())
          }
      Severity: Major
      Found in app/lobby/server/game_creator.js - About 3 hrs to fix

        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',
        Severity: Major
        Found in app/lobby/server/game_creator.js - About 2 hrs to fix

          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
          Severity: Minor
          Found in app/lobby/server/game_creator.js - About 2 hrs to fix

          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 create_player_cards has a Cognitive Complexity of 13 (exceeds 5 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())
              }
          Severity: Minor
          Found in app/lobby/server/game_creator.js - About 1 hr to fix

          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 create_game has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            create_game() {
              let cards = this.game_cards()
              let game_attributes = {
                players: _.shuffle(this.players),
                cards: cards,
          Severity: Minor
          Found in app/lobby/server/game_creator.js - About 1 hr to fix

            Function kingdom_cards has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              kingdom_cards() {
                let kingdom_cards = _.map(this.cards, (card) => {
                  return this.game_card(card, 'kingdom')
                })
            
            
            Severity: Minor
            Found in app/lobby/server/game_creator.js - About 1 hr to fix

              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
              Severity: Minor
              Found in app/lobby/server/game_creator.js - About 1 hr to fix

                Function kingdom_cards has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  kingdom_cards() {
                    let kingdom_cards = _.map(this.cards, (card) => {
                      return this.game_card(card, 'kingdom')
                    })
                
                
                Severity: Minor
                Found in app/lobby/server/game_creator.js - About 55 mins to fix

                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 create_game has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  create_game() {
                    let cards = this.game_cards()
                    let game_attributes = {
                      players: _.shuffle(this.players),
                      cards: cards,
                Severity: Minor
                Found in app/lobby/server/game_creator.js - About 35 mins to fix

                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
                Severity: Major
                Found in app/lobby/server/game_creator.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return 10
                  Severity: Major
                  Found in app/lobby/server/game_creator.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return 13
                    Severity: Major
                    Found in app/lobby/server/game_creator.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return 6
                      Severity: Major
                      Found in app/lobby/server/game_creator.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return 20
                        Severity: Major
                        Found in app/lobby/server/game_creator.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return 15
                          Severity: Major
                          Found in app/lobby/server/game_creator.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return 12
                            Severity: Major
                            Found in app/lobby/server/game_creator.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return 5
                              Severity: Major
                              Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return 30
                                Severity: Major
                                Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return 12
                                  Severity: Major
                                  Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                          return 12
                                    Severity: Major
                                    Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                            return 12
                                      Severity: Major
                                      Found in app/lobby/server/game_creator.js - About 30 mins to fix

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          dark_ages_game() {
                                            let card_names = CardList.dark_ages()
                                            let dark_ages_count = _.size(_.filter(this.selected_kingdom_cards, function(card) {
                                              return _.includes(card_names, _.titleize(card.name))
                                            }))
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 4 hrs to fix
                                        app/lobby/server/game_creator.js on lines 835..842

                                        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 115.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          prosperity_game() {
                                            let card_names = CardList.prosperity()
                                            let prosperity_count = _.size(_.filter(this.selected_kingdom_cards, function(card) {
                                              return _.includes(card_names, _.titleize(card.name))
                                            }))
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 4 hrs to fix
                                        app/lobby/server/game_creator.js on lines 844..851

                                        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 115.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          hexes() {
                                            let hexes = [
                                              new BadOmens(),
                                              new Delusion(),
                                              new Envy(),
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 3 hrs to fix
                                        app/lobby/server/game_creator.js on lines 669..687

                                        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 100.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          boons() {
                                            let boons = [
                                              new TheEarthsGift(),
                                              new TheFieldsGift(),
                                              new TheFlamesGift(),
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 3 hrs to fix
                                        app/lobby/server/game_creator.js on lines 689..707

                                        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 100.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                            if (this.game_has_card(this.selected_kingdom_cards, 'Page')) {
                                              _.each(['Treasure Hunter', 'Warrior', 'Hero', 'Champion'], (card_name) => {
                                                let card = ClassCreator.create(card_name)
                                                not_supply_cards.push(this.game_card(card.to_h(), 'not_supply'))
                                              })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 2 hrs to fix
                                        app/lobby/server/game_creator.js on lines 375..380

                                        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 85.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                            if (this.game_has_card(this.selected_kingdom_cards, 'Peasant')) {
                                              _.each(['Soldier', 'Fugitive', 'Disciple', 'Teacher'], (card_name) => {
                                                let card = ClassCreator.create(card_name)
                                                not_supply_cards.push(this.game_card(card.to_h(), 'not_supply'))
                                              })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 2 hrs to fix
                                        app/lobby/server/game_creator.js on lines 369..374

                                        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 85.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 4 locations. Consider refactoring.
                                        Open

                                            let ways = _.filter(cards, function(card) {
                                              return _.includes(CardList.way_cards(), _.titleize(card.name))
                                            })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 3 other locations - About 55 mins to fix
                                        app/lobby/server/game_creator.js on lines 8..10
                                        app/lobby/server/game_creator.js on lines 13..15
                                        app/lobby/server/game_creator.js on lines 18..20

                                        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 53.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 4 locations. Consider refactoring.
                                        Open

                                            let events = _.filter(cards, function(card) {
                                              return _.includes(CardList.event_cards(), _.titleize(card.name))
                                            })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 3 other locations - About 55 mins to fix
                                        app/lobby/server/game_creator.js on lines 13..15
                                        app/lobby/server/game_creator.js on lines 18..20
                                        app/lobby/server/game_creator.js on lines 23..25

                                        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 53.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 4 locations. Consider refactoring.
                                        Open

                                            let projects = _.filter(cards, function(card) {
                                              return _.includes(CardList.project_cards(), _.titleize(card.name))
                                            })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 3 other locations - About 55 mins to fix
                                        app/lobby/server/game_creator.js on lines 8..10
                                        app/lobby/server/game_creator.js on lines 13..15
                                        app/lobby/server/game_creator.js on lines 23..25

                                        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 53.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 4 locations. Consider refactoring.
                                        Open

                                            let landmarks = _.filter(cards, function(card) {
                                              return _.includes(CardList.landmark_cards(), _.titleize(card.name))
                                            })
                                        Severity: Major
                                        Found in app/lobby/server/game_creator.js and 3 other locations - About 55 mins to fix
                                        app/lobby/server/game_creator.js on lines 8..10
                                        app/lobby/server/game_creator.js on lines 18..20
                                        app/lobby/server/game_creator.js on lines 23..25

                                        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 53.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          event_cards(events) {
                                            events = this.set_card_ids_for_collection(events)
                                            return _.sortBy(events, function(event) {
                                              return -event.coin_cost
                                            })
                                        Severity: Minor
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 50 mins to fix
                                        app/lobby/server/game_creator.js on lines 230..235

                                        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 51.

                                        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

                                        Further Reading

                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                        Open

                                          project_cards(projects) {
                                            projects = this.set_card_ids_for_collection(projects)
                                            return _.sortBy(projects, function(project) {
                                              return -project.coin_cost
                                            })
                                        Severity: Minor
                                        Found in app/lobby/server/game_creator.js and 1 other location - About 50 mins to fix
                                        app/lobby/server/game_creator.js on lines 223..228

                                        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 51.

                                        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

                                        Further Reading

                                        There are no issues that match your filters.

                                        Category
                                        Status