eager-dev/eagerx

View on GitHub
eagerx/core/env.py

Summary

Maintainability
B
4 hrs
Test Coverage
A
97%

Function _shutdown has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _shutdown(self):
        if not self.has_shutdown:
            self._shutdown_srv.unregister()
            for address, node in self._launch_nodes.items():
                self.backend.logdebug(f"[{self.name}] Send termination signal to '{address}'.")
Severity: Minor
Found in eagerx/core/env.py - 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 __init__ has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(
        self,
        name: str,
        rate: float,
        graph: Graph,
Severity: Minor
Found in eagerx/core/env.py - About 1 hr to fix

    Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def render(self) -> Optional[np.ndarray]:
            """A method to start rendering (i.e. open the render window).
    
            A bool message to topic address ":attr:`~eagerx.core.env.BaseEnv.name` */env/render/toggle*",
            which toggles the rendering on/off.
    Severity: Minor
    Found in eagerx/core/env.py - 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_supervisor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _create_supervisor(environment: NodeSpec, engine: EngineSpec, nodes: List[NodeSpec]) -> BaseNodeSpec:
            entity_type = f"{SupervisorNode.__module__}/{SupervisorNode.__name__}"
            spec = Node.pre_make("N/a", entity_type)
            spec.add_output("step", space=Space(shape=(), dtype="int64"))
    
    
    Severity: Minor
    Found in eagerx/core/env.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 _observation_space has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _observation_space(self) -> gym.spaces.Dict:
            """Infers the observation space from the space of every observation.
    
            This space defines the format of valid observations.
    
    
    Severity: Minor
    Found in eagerx/core/env.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

    There are no issues that match your filters.

    Category
    Status