eager-dev/eagerx

View on GitHub

Showing 100 of 120 total issues

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

    def initialize(self, spec: NodeSpec):
        # Define observation buffers
        self.observation_buffer = dict()
        for cname, i in self.inputs.items():
            if isinstance(i["space"], dict):
Severity: Minor
Found in eagerx/core/nodes.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 node_shutdown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def node_shutdown(self):
        if not self.has_shutdown:
            self.backend.logdebug(f"[{self.name}] RxEngine.node_shutdown() called.")
            for address, node in self.engine.launch_nodes.items():
                self.backend.loginfo(f"[{self.name}] Send termination signal to '{address}'.")
Severity: Minor
Found in eagerx/core/executable_engine.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 make has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def make(
        cls,
        name: str,
        sensors: Optional[List[str]] = None,
        env_id: str = "Pendulum-v1",
Severity: Minor
Found in eagerx/engines/openai_gym/objects.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 _config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _config(resolved, a, args, context):
    """
    process $(config) arg

    :returns: updated resolved argument, ``str``
Severity: Minor
Found in eagerx/utils/utils_sub.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_state_inputs_channel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def init_state_inputs_channel(ns, state_inputs, scheduler, node):
    if len(state_inputs) > 0:
        channels = []
        for s in state_inputs:
            d = s["done"].pipe(
Severity: Minor
Found in eagerx/core/rx_operators.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 _ns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _ns(resolved, a, args, context):
    """
    process $(ns) arg

    :returns: updated resolved argument, ``str``
Severity: Minor
Found in eagerx/utils/utils_sub.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 _publish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _publish(self, msg: typing.Union[float, bool, int, str, np.ndarray, np.number], header: Header) -> None:
        if not self._unregistered:
            # todo: check if dtype(msg) == self._dtype?
            # Convert python native types to numpy arrays.
            if isinstance(msg, float):
Severity: Minor
Found in eagerx/backends/single_process.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

Avoid deeply nested control flow statements.
Open

                    if not G.nodes[v]["always_active"]:
                        new_stale_nodes.append(v)
                        G.nodes[v]["is_stale"] = True
    remain_active = [n for n, is_stale in nx.get_node_attributes(G, "remain_active").items() if is_stale]
Severity: Major
Found in eagerx/utils/network_utils.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if cname_address in self.disconnected[node_name][key]:
                                color = "red"
                            if cname_address in self.connected_rx[node_name][key]:
    Severity: Major
    Found in eagerx/core/rx_message_broker.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if cname_address in self.connected_bnd[node_name][key]:
                                  assert color is None, f"Duplicate connection status for address ({cname_address})."
                                  color = "blue"
                              assert (
      Severity: Major
      Found in eagerx/core/rx_message_broker.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if mode == 0:
                                    i[key] = filter_info_for_printing(msg.info)
                                else:
                                    i[key] = msg.msgs
                else:
        Severity: Major
        Found in eagerx/core/rx_operators.py - About 45 mins to fix

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

          def engine(engine_cls: "Engine", entity=None) -> Callable:
              """A decorator to register an engine implementation of an :class:`~eagerx.core.entities.Object`.
          
              .. note:: In our running example, the :func:`~eagerx.core.entities.Object.example_engine` method would be decorated.
          
          
          Severity: Minor
          Found in eagerx/core/register.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_state_resets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def init_state_resets(ns, state_inputs, trigger, scheduler, tp_scheduler, node):
              if len(state_inputs) > 0:
                  channels = []
          
                  for s in state_inputs:
          Severity: Minor
          Found in eagerx/core/rx_operators.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 _connect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _connect(
                  self,
                  source: SpecView = None,
                  target: SpecView = None,
                  window: Optional[int] = None,
          Severity: Minor
          Found in eagerx/core/graph.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_node has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def init_node(
              ns,
              rate_node,
              node,
              inputs,
          Severity: Minor
          Found in eagerx/core/rx_pipelines.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

          Avoid deeply nested control flow statements.
          Open

                                  with self.feedthroughs as d:
                                      d[cname] = mapping_ft
                          elif component == "inputs":
          Severity: Major
          Found in eagerx/core/specs.py - About 45 mins to fix

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

                def callback(self, t_n: float, tick: Optional[Msg] = None):
                    assert isinstance(self.simulator, dict), (
                        'Simulator object "%s" is not compatible with this engine node.' % self.simulator
                    )
                    with self._cond:
            Severity: Minor
            Found in eagerx/engines/openai_gym/enginenodes.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 init_real_reset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def init_real_reset(
                ns,
                Nc,
                rate_node,
                RR,
            Severity: Minor
            Found in eagerx/core/rx_operators.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 cb_ft has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def cb_ft(cb_input, sync):
                # Fill output msg with number of node ticks
                output_msgs = dict()
                for key, msg in cb_input.items():
                    if key not in ["node_tick", "t_n"]:
            Severity: Minor
            Found in eagerx/core/rx_operators.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 callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def callback(self, t_n: float, image: Optional[eagerx.utils.utils.Msg] = None):
                    # Fill output_msg with 'done' output --> signals that we are done rendering
                    output_msgs = dict(done=0)
                    # Grab latest image
                    self.last_image = image.msgs[-1] if self.encoding == "rgb" else cv2.cvtColor(image.msgs[-1], cv2.COLOR_BGR2RGB)
            Severity: Minor
            Found in eagerx/core/nodes.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

            Severity
            Category
            Status
            Source
            Language