eager-dev/eagerx

View on GitHub
eagerx/utils/utils_sub.py

Summary

Maintainability
D
2 days
Test Coverage

Function _collect_args has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def _collect_args(arg_str):
    """
    State-machine parser for resolve_args. Substitution args are of the form:
    $(find package_name)/scripts/foo.py $(export some/attribute blar) non-relevant stuff

Severity: Minor
Found in eagerx/utils/utils_sub.py - About 3 hrs 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 convert_value has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def convert_value(value, type_):
    """
    Convert a value from a string representation into the specified
    type

Severity: Minor
Found in eagerx/utils/utils_sub.py - About 2 hrs 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 18 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_args(arg_str, context=None, resolve_anon=True, filename=None, only=None):
    """
    Resolves substitution args (see wiki spec U{http://ros.org/wiki/roslaunch}).

    @param arg_str: string to resolve zero or more substitution args
Severity: Minor
Found in eagerx/utils/utils_sub.py - About 2 hrs 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 substitute_args has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def substitute_args(
    param: Union[str, Dict],
    context: Optional[Dict] = None,
    only: Optional[List[str]] = None,
):
Severity: Minor
Found in eagerx/utils/utils_sub.py - About 2 hrs 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 _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 _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

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

              There are no issues that match your filters.

              Category
              Status