eager-dev/eagerx

View on GitHub

Showing 100 of 120 total issues

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

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 logsilent
    Severity: Major
    Found in eagerx/core/entities.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return float(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 False
        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

            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

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

                  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 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 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 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 _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 __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 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 _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 __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

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

                  Severity
                  Category
                  Status
                  Source
                  Language