eager-dev/eagerx

View on GitHub
eagerx/backends/single_process.py

Summary

Maintainability
A
3 hrs
Test Coverage
A
92%

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

def merge(a: typing.Dict, b: typing.Dict, path=None):
    """merges b into a"""
    if path is None:
        path = []
    for key in b:
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 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 _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

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

There are no issues that match your filters.

Category
Status