jcbantuelle/dominion-meteor

View on GitHub
app/cards/lib/card_list.js

Summary

Maintainability
F
1 wk
Test Coverage

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
Severity: Major
Found in app/cards/lib/card_list.js - About 1 day to fix

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

    CardList = class CardList {
    
      constructor(exclusions, edition) {
        this.edition = edition
        this.exclusions = exclusions
    Severity: Minor
    Found in app/cards/lib/card_list.js - About 6 hrs to fix

      Function dark_ages has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static dark_ages() {
          return [
            'PoorHouse',
            'Beggar',
            'Squire',
      Severity: Minor
      Found in app/cards/lib/card_list.js - About 1 hr to fix

        Function nocturne has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static nocturne() {
            return [
              'Druid',
              'FaithfulHound',
              'Guardian',
        Severity: Minor
        Found in app/cards/lib/card_list.js - About 1 hr to fix

          Function menagerie has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static menagerie() {
              return [
                'BlackCat',
                'Sleigh',
                'Supplies',
          Severity: Minor
          Found in app/cards/lib/card_list.js - About 1 hr to fix

            Function adventures has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static adventures() {
                return [
                  'CoinOfTheRealm',
                  'Page',
                  'Peasant',
            Severity: Minor
            Found in app/cards/lib/card_list.js - About 1 hr to fix

              Function base2 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static base2() {
                  return [
                    'Cellar',
                    'Chapel',
                    'Moat',
              Severity: Minor
              Found in app/cards/lib/card_list.js - About 1 hr to fix

                Function seaside has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  static seaside() {
                    return [
                      'Embargo',
                      'Haven',
                      'Lighthouse',
                Severity: Minor
                Found in app/cards/lib/card_list.js - About 1 hr to fix

                  Function hinterlands has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static hinterlands() {
                      return [
                        'Crossroads',
                        'Duchess',
                        'FoolsGold',
                  Severity: Minor
                  Found in app/cards/lib/card_list.js - About 1 hr to fix

                    Function intrigue2 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static intrigue2() {
                        return [
                          'Courtyard',
                          'Lurker',
                          'Pawn',
                    Severity: Minor
                    Found in app/cards/lib/card_list.js - About 1 hr to fix

                      Function base1 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        static base1() {
                          return [
                            'Cellar',
                            'Chapel',
                            'Moat',
                      Severity: Minor
                      Found in app/cards/lib/card_list.js - About 1 hr to fix

                        Function prosperity has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static prosperity() {
                            return [
                              'Loan',
                              'TradeRoute',
                              'Watchtower',
                        Severity: Minor
                        Found in app/cards/lib/card_list.js - About 1 hr to fix

                          Function intrigue1 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            static intrigue1() {
                              return [
                                'Courtyard',
                                'Pawn',
                                'SecretChamber',
                          Severity: Minor
                          Found in app/cards/lib/card_list.js - About 1 hr to fix

                            Function renaissance has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              static renaissance() {
                                return [
                                  'BorderGuard',
                                  'Ducat',
                                  'Lackeys',
                            Severity: Minor
                            Found in app/cards/lib/card_list.js - About 1 hr to fix

                              Function empires has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                static empires() {
                                  return [
                                    'Engineer',
                                    'CityQuarter',
                                    'Overlord',
                              Severity: Minor
                              Found in app/cards/lib/card_list.js - About 1 hr to fix

                                Function pull_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  pull_set() {
                                    let game_cards = _.sampleSize(this.cards, 10)
                                
                                    let aside_cards = _.filter(game_cards, (card_name) => {
                                      return _.includes(CardList.aside_cards(this.exclusions, this.edition), card_name)
                                Severity: Minor
                                Found in app/cards/lib/card_list.js - About 25 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

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

                                  static landmark_cards(exclusions = [], edition) {
                                    let exclusions_for_edition = CardList.exclusions_for_edition(exclusions, edition)
                                    return _.reduce(CardList.landmark_sets(edition), function(card_list, set) {
                                      if (!_.includes(exclusions_for_edition, set)) {
                                        if (_.includes(['base', 'intrigue'], set)) {
                                Severity: Major
                                Found in app/cards/lib/card_list.js and 3 other locations - About 5 hrs to fix
                                app/cards/lib/card_list.js on lines 120..131
                                app/cards/lib/card_list.js on lines 146..157
                                app/cards/lib/card_list.js on lines 159..170

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

                                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

                                  static way_cards(exclusions = [], edition) {
                                    let exclusions_for_edition = CardList.exclusions_for_edition(exclusions, edition)
                                    return _.reduce(CardList.way_sets(edition), function(card_list, set) {
                                      if (!_.includes(exclusions_for_edition, set)) {
                                        if (_.includes(['base', 'intrigue'], set)) {
                                Severity: Major
                                Found in app/cards/lib/card_list.js and 3 other locations - About 5 hrs to fix
                                app/cards/lib/card_list.js on lines 120..131
                                app/cards/lib/card_list.js on lines 133..144
                                app/cards/lib/card_list.js on lines 146..157

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

                                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

                                  static project_cards(exclusions = [], edition) {
                                    let exclusions_for_edition = CardList.exclusions_for_edition(exclusions, edition)
                                    return _.reduce(CardList.project_sets(edition), function(card_list, set) {
                                      if (!_.includes(exclusions_for_edition, set)) {
                                        if (_.includes(['base', 'intrigue'], set)) {
                                Severity: Major
                                Found in app/cards/lib/card_list.js and 3 other locations - About 5 hrs to fix
                                app/cards/lib/card_list.js on lines 120..131
                                app/cards/lib/card_list.js on lines 133..144
                                app/cards/lib/card_list.js on lines 159..170

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

                                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

                                  static event_cards(exclusions = [], edition) {
                                    let exclusions_for_edition = CardList.exclusions_for_edition(exclusions, edition)
                                    return _.reduce(CardList.event_sets(edition), function(card_list, set) {
                                      if (!_.includes(exclusions_for_edition, set)) {
                                        if (_.includes(['base', 'intrigue'], set)) {
                                Severity: Major
                                Found in app/cards/lib/card_list.js and 3 other locations - About 5 hrs to fix
                                app/cards/lib/card_list.js on lines 133..144
                                app/cards/lib/card_list.js on lines 146..157
                                app/cards/lib/card_list.js on lines 159..170

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

                                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

                                    let aside_cards = _.filter(game_cards, (card_name) => {
                                      return _.includes(CardList.aside_cards(this.exclusions, this.edition), card_name)
                                    })
                                Severity: Minor
                                Found in app/cards/lib/card_list.js and 1 other location - About 50 mins to fix
                                app/cards/lib/card_list.js on lines 55..57

                                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

                                        let ways_card = _.find(game_cards, (card_name) => {
                                          return _.includes(CardList.way_cards(this.exclusions, this.edition), card_name)
                                        })
                                Severity: Minor
                                Found in app/cards/lib/card_list.js and 1 other location - About 50 mins to fix
                                app/cards/lib/card_list.js on lines 13..15

                                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