eager-dev/eagerx

View on GitHub

Showing 120 of 120 total issues

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

def switch_to_reset():
    def _switch_to_reset(source):
        def subscribe(observer, scheduler=None):
            reset_mode = [False]

Severity: Minor
Found in eagerx/core/rx_operators.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

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

        ops.map(lambda x: x[0][:-1] + (x[1],)),
Severity: Major
Found in eagerx/core/rx_pipelines.py and 1 other location - About 1 hr to fix
eagerx/core/rx_pipelines.py on lines 685..685

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

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

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

        ops.map(lambda x: x[0][:-1] + (x[1],)),
Severity: Major
Found in eagerx/core/rx_pipelines.py and 1 other location - About 1 hr to fix
eagerx/core/rx_pipelines.py on lines 323..323

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

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

    def _prepare_io_topics(self, name: str, env_node: EnvNode):
        params = get_param_with_blocking(name, self.backend)

        # Get info from engine on reactive properties
        sync = get_param_with_blocking(self.ns + "/sync", self.backend)
Severity: Minor
Found in eagerx/core/supervisor.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 supported_types has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def supported_types(*types: Tuple, is_classmethod=True):
    # Check if we support NoneType
    none_support = False
    for a in types:
        if a is None:
Severity: Minor
Found in eagerx/utils/utils.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_supervisor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def init_supervisor(ns, node, outputs=tuple(), state_outputs=tuple()):
    # Initialize schedulers
    tp_scheduler = ThreadPoolScheduler(max_workers=5)
    reset_disp = CompositeDisposable()

Severity: Minor
Found in eagerx/core/rx_pipelines.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if self._space is None:
                return (
                    isinstance(other, Space)
                    and other._space is None
                    and (self.shape == other.shape)
    Severity: Major
    Found in eagerx/core/space.py - About 1 hr to fix

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

          d_Ns = P.pipe(ops.scan(lambda acc, x: acc + 1, 0)).subscribe(Ns)
      Severity: Minor
      Found in eagerx/core/rx_pipelines.py and 1 other location - About 55 mins to fix
      eagerx/core/rx_pipelines.py on lines 117..117

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

      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

          d_Ns = P.pipe(ops.scan(lambda acc, x: acc + 1, 0)).subscribe(Ns)
      Severity: Minor
      Found in eagerx/core/rx_pipelines.py and 1 other location - About 55 mins to fix
      eagerx/core/rx_pipelines.py on lines 441..441

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

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

      def _register_types(TYPE_REGISTER, component, cnames, func, space_only=True):
          name_split = func.__qualname__.split(".")
          cls_name = name_split[0]
          fn_name = name_split[1]
          entity_id = func.__module__ + "/" + cls_name
      Severity: Minor
      Found in eagerx/core/register.py - About 55 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 filter_dict has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def filter_dict():
          def _filter_dict(source):
              def subscribe(observer, scheduler=None):
                  def on_next(value):
                      d = dict()
      Severity: Minor
      Found in eagerx/core/rx_operators.py - About 55 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 _resolve_args has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _resolve_args(arg_str, context, resolve_anon, commands):
          ros_valid = ["find", "env", "optenv", "dirname", "anon", "arg"]
          valid = ros_valid + ["ns", "config"]
          resolved = arg_str
          if isinstance(arg_str, (str, list)):
      Severity: Minor
      Found in eagerx/utils/utils_sub.py - About 55 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_param_with_blocking has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_param_with_blocking(name, backend, default=_unspecified, timeout=2.0):
          params = Unspecified()
          start = time.time()
          while isinstance(params, Unspecified):
              if time.time() - start > timeout:
      Severity: Minor
      Found in eagerx/utils/utils.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_engine has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def init_engine(
          ns,
          rate_node,
          node,
          inputs_init,
      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

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

        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

        Severity
        Category
        Status
        Source
        Language