eager-dev/eagerx

View on GitHub
eagerx/core/specs.py

Summary

Maintainability
C
1 day
Test Coverage
A
98%

Function initialize has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(self, spec_cls):
        import eagerx.core.register as register

        try:
            params = register.LOOKUP_TYPES[spec_cls.callback]
Severity: Minor
Found in eagerx/core/specs.py - About 5 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 build has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def build(self, ns: str):
        params = self.params  # Creates a deepcopy
        name = self.config.name
        entity_id = self.config.entity_id

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

Avoid deeply nested control flow statements.
Open

                        with self.feedthroughs as d:
                            d[cname] = mapping_ft
                elif component == "inputs":
Severity: Major
Found in eagerx/core/specs.py - About 45 mins to fix

    Function _add_engine_states has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _add_engine_states(self, name: str, spec: ObjectSpec):
            # Pop states that were not implemented.
            assert name in self.objects, f"There is no Object called `{name}' in engine.objects. First add the Object."
            states = spec.engine.states
            for cname in list(states.keys()):
    Severity: Minor
    Found in eagerx/core/specs.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

    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

    There are no issues that match your filters.

    Category
    Status