eager-dev/eagerx

View on GitHub

Showing 120 of 120 total issues

Avoid too many return statements within this function.
Open

            return self.logfatal
Severity: Major
Found in eagerx/core/entities.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return False
    Severity: Major
    Found in eagerx/utils/utils_sub.py - About 30 mins to fix

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

          RrRn = rx.zip(Rr.pipe(spy("Rr", node)), Rn.pipe(spy("Rn", node))).pipe(
      Severity: Minor
      Found in eagerx/core/rx_pipelines.py and 1 other location - About 30 mins to fix
      eagerx/core/rx_pipelines.py on lines 712..712

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

      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

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

          for i in outputs:
              # Prepare output topic
              i["msg"] = Subject()
      
              # Initialize reset topic
      Severity: Minor
      Found in eagerx/core/rx_pipelines.py and 1 other location - About 30 mins to fix
      eagerx/core/rx_pipelines.py on lines 250..255

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

      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 int(value)
      Severity: Major
      Found in eagerx/utils/utils_sub.py - About 30 mins to fix

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

            d = rx.zip(f.pipe(spy("F", node)), Rr.pipe(spy("Rr", node))).pipe(ops.share()).subscribe(ResetTrigger)
        Severity: Minor
        Found in eagerx/core/rx_pipelines.py and 1 other location - About 30 mins to fix
        eagerx/core/rx_pipelines.py on lines 311..311

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

        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 value
        Severity: Major
        Found in eagerx/utils/utils_sub.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return yaml.safe_load(value)
          Severity: Major
          Found in eagerx/utils/utils_sub.py - About 30 mins to fix

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

                for i in outputs:
                    # Prepare output topic
                    i["msg"] = Subject()
            
                    # Initialize reset topic
            Severity: Minor
            Found in eagerx/core/rx_pipelines.py and 1 other location - About 30 mins to fix
            eagerx/core/rx_pipelines.py on lines 531..536

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

            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 _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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(self, spec, simulator):
                    # We will probably use self.simulator in callback & reset.
                    assert (
                        self.process == process.ENGINE
                    ), "Simulation node requires a reference to the simulator, hence it must be launched in the Engine process"
            Severity: Minor
            Found in eagerx/engines/openai_gym/enginenodes.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

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

                def connect(
                    self,
                    source: Optional[SpecView] = None,
                    target: Optional[SpecView] = None,
                    actuator: str = None,
            Severity: Minor
            Found in eagerx/core/graph_engine.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 _publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _publish(self, msg: typing.Union[float, bool, int, str, np.ndarray, np.number], header: Header) -> None:
                    # Convert python native types to numpy arrays.
                    if isinstance(msg, float):
                        msg = np.array(msg, dtype="float32")
                    elif isinstance(msg, bool):
            Severity: Minor
            Found in eagerx/backends/ros1.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 delete_param has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def delete_param(self, param: str, level: int = 1) -> None:
                    try:
                        keys = [k for k in param.split("/") if len(k) > 0]
                        val = self._pserver
                        for key in keys[:-1]:
            Severity: Minor
            Found in eagerx/backends/single_process.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def build(self, ns: str):
                    params = super().build(ns)
            
                    # Convert engine states
                    for name, obj in params[self.config.name]["objects"].items():
            Severity: Minor
            Found in eagerx/core/specs.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 get_log_fn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_log_fn(self, log_level: int) -> Callable:
                    if log_level == DEBUG:
                        return self.logdebug
                    elif log_level == INFO:
                        return self.loginfo
            Severity: Minor
            Found in eagerx/core/entities.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 __getitem__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getitem__(self, spec_lookup):
                    for _entity_cls, entity_id in self._dict.items():
                        for entity_idd, entry in entity_id.items():
                            if entry["spec"] == spec_lookup:
                                return entity_idd
            Severity: Minor
            Found in eagerx/core/register.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 reset_graph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def reset_graph(G):
                # Create a shallow copy graph that excludes feedthrough edges
                F = nx.MultiDiGraph(G)
                for u, v, key, data in G.edges(data=True, keys=True):
                    if data["feedthrough"]:
            Severity: Minor
            Found in eagerx/utils/network_utils.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 __eq__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def __eq__(self, other):
                    if self._space is None:
                        return (
                            isinstance(other, Space)
                            and other._space is None
            Severity: Minor
            Found in eagerx/core/space.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