eager-dev/eagerx

View on GitHub

Showing 100 of 120 total issues

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

def color_nodes(G):
    # Color nodes based on in/out going edges
    for n, data in G.nodes(data=True):
        if data["is_stale"]:
            facecolor = "lightgrey"
Severity: Minor
Found in eagerx/utils/network_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 initialize_nodes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def initialize_nodes(
    nodes: Union["BaseNodeSpec", List["BaseNodeSpec"]],
    process_id: int,
    ns: str,
    message_broker: Any,
Severity: Minor
Found in eagerx/utils/node_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 wait_for_node_initialization has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def wait_for_node_initialization(is_initialized, backend, wait_time=0.3):
    iter = 0

    # Wait for nodes to be initialized
    while True:
Severity: Minor
Found in eagerx/utils/node_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__ 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 _convert_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def _convert_type(param):
        if type(param) in supported_types or param is None:
            return param
        else:
            if isinstance(param, SpecView):
    Severity: Minor
    Found in eagerx/core/view.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 callback has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def callback(self, msg):
            if not isinstance(msg, tuple(_ROS_TO_NUMPY)):
                Ros1.logerr(f"[subscriber][{self._name}]: type(recv)={type(msg)}")
                time.sleep(10000000)
    
    
    Severity: Minor
    Found in eagerx/backends/ros1.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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(self, spec_cls):
            import eagerx.core.register as register
    
            agnostic = register.LOOKUP_TYPES[spec_cls.make]
    
    
    Severity: Minor
    Found in eagerx/core/specs.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 split has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def split(a: typing.Any):
        if isinstance(a, dict):
            for key in list(a):
                value = a.pop(key)
                value = split(value)
    Severity: Minor
    Found in eagerx/backends/single_process.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 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

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

        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
          Severity
          Category
          Status
          Source
          Language