SforAiDl/genrl

View on GitHub

Showing 54 of 58 total issues

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

    def forward(
        self, x: torch.Tensor, kl: bool = True, frozen: bool = False
    ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
        """Apply linear transormation to input.

Severity: Minor
Found in genrl/agents/bandits/contextual/common/bayesian.py - 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 worker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def worker(parent_conn: mp.Pipe, child_conn: mp.Pipe, env: gym.Env):
    """
    Worker class to facilitate multiprocessing

    :param parent_conn: Parent connection of Pipe
Severity: Minor
Found in genrl/environments/vec_env/vector_envs.py - 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 generate has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def generate(
Severity: Minor
Found in examples/genetic_rl.py - About 45 mins to fix

    Function generate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate(
    Severity: Minor
    Found in examples/genetic_rl_q_learning.py - About 45 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in genrl/agents/deep/dqn/categorical.py - About 45 mins to fix

        Function get_action has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_action(
                self, state: torch.Tensor, deterministic: bool = False
            ) -> torch.Tensor:
                """
                        Get action from policy based on input
        Severity: Minor
        Found in genrl/core/base.py - About 45 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Minor
        Found in genrl/core/policies.py - About 45 mins to fix

          Function get_env_properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_env_properties(
              env: Union[gym.Env, VecEnv], network: Union[str, Any] = "mlp"
          ) -> (Tuple[int]):
              """
                  Finds important properties of environment
          Severity: Minor
          Found in genrl/utils/utils.py - About 45 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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def write(self, kvs: Dict[str, Any], log_key) -> None:
                  """
                  Add entry to logger
          
                  :param kvs: Entries to be logged
          Severity: Minor
          Found in genrl/utils/logger.py - About 45 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in genrl/core/policies.py - About 45 mins to fix

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in genrl/agents/deep/a2c/a2c.py - About 45 mins to fix

              Function _get_val_model has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _get_val_model(
              Severity: Minor
              Found in genrl/core/values.py - About 45 mins to fix

                Function add has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def add(
                Severity: Minor
                Found in genrl/core/rollout_storage.py - About 45 mins to fix

                  Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Minor
                  Found in genrl/core/rollout_storage.py - About 35 mins to fix

                    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Minor
                    Found in genrl/core/noise.py - About 35 mins to fix

                      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Minor
                      Found in genrl/agents/deep/dqn/base.py - About 35 mins to fix

                        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def __init__(
                        Severity: Minor
                        Found in genrl/agents/deep/td3/td3.py - About 35 mins to fix

                          Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(
                          Severity: Minor
                          Found in genrl/core/base.py - About 35 mins to fix

                            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(
                            Severity: Minor
                            Found in genrl/trainers/bandit.py - About 35 mins to fix

                              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def __init__(
                              Severity: Minor
                              Found in genrl/core/values.py - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language