durandtibo/objectory

View on GitHub

Showing 4 of 6 total issues

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

    def register_object(self, obj: type | Callable, name: str | None = None) -> None:
        r"""Register an object.

        Please read the documentation for more information.

Severity: Minor
Found in src/objectory/registry.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 resolve_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_name(name: str, object_names: set[str], allow_import: bool = True) -> str | None:
    r"""Find a match of the query name in the set of object names.

    The resolution is successful only if there is only one object
    name that can match with the query name.
Severity: Minor
Found in src/objectory/utils/name_resolution.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

Function clear_filters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def clear_filters(self, nested: bool = False) -> None:
        r"""Clear all the filters of the registry.

        Args:
            nested: Indicates if the filters of all the sub-registries
Severity: Minor
Found in src/objectory/registry.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

Function clear has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def clear(self, nested: bool = False) -> None:
        r"""Clear the registry.

        This functions removes all the registered objects in the
        registry.
Severity: Minor
Found in src/objectory/registry.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

Severity
Category
Status
Source
Language