JohannesHeidecke/irl-benchmark

View on GitHub

Showing 29 of 61 total issues

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

    def __init__(self, env: gym.Env, expert_trajs: List[Dict[str, list]],
Severity: Minor
Found in irl_benchmark/irl/algorithms/appr_irl.py - About 35 mins to fix

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

        def __init__(self, env: gym.Env, expert_trajs: List[Dict[str, list]],
    Severity: Minor
    Found in irl_benchmark/irl/algorithms/mce_irl.py - About 35 mins to fix

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

          def __init__(self,
      Severity: Minor
      Found in irl_benchmark/irl/algorithms/base_algorithm.py - About 35 mins to fix

        Function get_maps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_maps(ascii_map: List[str]) -> (np.ndarray, np.ndarray):
            """Transform an ASCII-ascii_map into matrices of walls and rewards
        
            Parameters
            ----------
        Severity: Minor
        Found in irl_benchmark/envs/maze_world.py - 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

        Function train has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def train(self, no_episodes: int):
                """ Train the agent
        
                Parameters
                ----------
        Severity: Minor
        Found in irl_benchmark/rl/algorithms/value_iteration.py - 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

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

        def unwrap_env(env: gym.Env,
                       until_class: Union[None, gym.Env] = None) -> gym.Env:
            """Unwrap wrapped env until we get an instance that is a until_class.
        
            If until_class is None, env will be unwrapped until the lowest layer.
        Severity: Minor
        Found in irl_benchmark/utils/wrapper.py - 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

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

            def domain(self) -> Union[State, StateAction, StateActionState]:
                """Return the entire domain of the reward function.
        
                Returns
                -------
        Severity: Minor
        Found in irl_benchmark/irl/reward/reward_function.py - 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

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

        def make_env(env_id: str):
            """Make a basic gym environment, without any special wrappers.
        
            Parameters
            ----------
        Severity: Minor
        Found in irl_benchmark/envs/__init__.py - 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

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

            def __init__(self, map_id: int = 0):
                """
        
                Parameters
                ----------
        Severity: Minor
        Found in irl_benchmark/envs/maze_world.py - 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

        Severity
        Category
        Status
        Source
        Language