fedden/pluribus-poker-AI

View on GitHub

Showing 21 of 21 total issues

Consider simplifying this complex logical expression.
Open

    if all(c_rank == 14 for c_rank in ranks):
        return 0
    elif all(c_rank == 13 for c_rank in ranks):
        return 1
    elif all(c_rank == 12 for c_rank in ranks):
Severity: Critical
Found in poker_ai/clustering/preflop.py - About 2 hrs to fix

    Card has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Card:
        """Card to represent a poker card."""
    
        def __init__(self, rank: Union[str, int], suit: str):
            """Instanciate the card."""
    Severity: Minor
    Found in poker_ai/poker/card.py - About 2 hrs to fix

      Function cssLoaders has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.cssLoaders = function (options) {
        options = options || {}
      
        const cssLoader = {
          loader: 'css-loader',
      Severity: Minor
      Found in applications/visualisation/frontend/build/utils.js - About 1 hr to fix

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

                            EvaluationCard.PRIMES[pairrank] ** 2
                            * EvaluationCard.PRIMES[k1]
                            * EvaluationCard.PRIMES[k2]
        Severity: Major
        Found in poker_ai/poker/evaluation/lookup.py and 1 other location - About 1 hr to fix
        poker_ai/poker/evaluation/lookup.py on lines 216..216

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

        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

                        product = EvaluationCard.PRIMES[r] ** 3 * EvaluationCard.PRIMES[c1] * EvaluationCard.PRIMES[c2]
        Severity: Major
        Found in poker_ai/poker/evaluation/lookup.py and 1 other location - About 1 hr to fix
        poker_ai/poker/evaluation/lookup.py on lines 254..256

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

        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

        Function __init__ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                strategy_interval: int,
                n_iterations: int,
                lcfr_threshold: int,
        Severity: Minor
        Found in poker_ai/ai/multiprocess/server.py - About 1 hr to fix

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

                              EvaluationCard.PRIMES[pair1] ** 2
                              * EvaluationCard.PRIMES[pair2] ** 2
          Severity: Minor
          Found in poker_ai/poker/evaluation/lookup.py and 1 other location - About 45 mins to fix
          poker_ai/poker/evaluation/lookup.py on lines 199..199

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

          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

          Avoid deeply nested control flow statements.
          Open

                              if action == "quit":
                                  user_results.add_result(strategy_path, agent, state, og_name_to_name)
                                  log.info(term.pink("quit"))
                                  break
                              elif action == "new game":
          Severity: Major
          Found in poker_ai/terminal/runner.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if selected_action_i < 0:
                                    selected_action_i = len(legal_actions) - 1
                            elif key.name == "KEY_RIGHT":
            Severity: Major
            Found in poker_ai/terminal/runner.py - About 45 mins to fix

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

                              product = EvaluationCard.PRIMES[i] ** 3 * EvaluationCard.PRIMES[pr] ** 2
              Severity: Minor
              Found in poker_ai/poker/evaluation/lookup.py and 1 other location - About 45 mins to fix
              poker_ai/poker/evaluation/lookup.py on lines 233..234

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

              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

              Avoid too many return statements within this function.
              Open

                      return 12 if suited else 22
              Severity: Major
              Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return 7 if suited else 17
                Severity: Major
                Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 9 if suited else 19
                  Severity: Major
                  Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return 8 if suited else 18
                    Severity: Major
                    Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return 11 if suited else 21
                      Severity: Major
                      Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return 13 if suited else 23
                        Severity: Major
                        Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return 6 if suited else 16
                          Severity: Major
                          Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return 10 if suited else 20
                            Severity: Major
                            Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return 14 if suited else 24
                              Severity: Major
                              Found in poker_ai/clustering/preflop.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return 4
                                Severity: Major
                                Found in poker_ai/clustering/preflop.py - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language