zincware/ZnTrack

View on GitHub
zntrack/core/nodify.py

Summary

Maintainability
D
2 days
Test Coverage

File nodify.py has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""The @nodify decorator."""

import copy
import dataclasses
import json
Severity: Minor
Found in zntrack/core/nodify.py - About 5 hrs to fix

    Function check_type has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_type(
        obj, types, allow_iterable=False, allow_none=False, allow_dict=False
    ) -> bool:
        """Check if the obj is of the given types.
    
    
    Severity: Minor
    Found in zntrack/core/nodify.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 nodify has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def nodify(
        *,
        params: dict = None,
        outs: UnionDictListOfStrPath = None,
        outs_no_cache: UnionDictListOfStrPath = None,
    Severity: Minor
    Found in zntrack/core/nodify.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 write_dvc_command has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def write_dvc_command(self, node_name: str) -> list:
            """Collect dvc commands.
    
            Parameters
            ----------
    Severity: Minor
    Found in zntrack/core/nodify.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 wrapper has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def wrapper(
    Severity: Major
    Found in zntrack/core/nodify.py - About 1 hr to fix

      Function nodify has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def nodify(
      Severity: Major
      Found in zntrack/core/nodify.py - About 1 hr to fix

        Function prepare_dvc_script has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def prepare_dvc_script(
        Severity: Major
        Found in zntrack/core/nodify.py - About 50 mins to fix

          Function check_type has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def check_type(
          Severity: Minor
          Found in zntrack/core/nodify.py - About 35 mins to fix

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

                def __post_init__(self):
                    """Dataclass post_init."""
                    for datacls_field in dataclasses.fields(self):
                        # type checking
                        option_value = getattr(self, datacls_field.name)
            Severity: Minor
            Found in zntrack/core/nodify.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

            Avoid too many return statements within this function.
            Open

                return True
            Severity: Major
            Found in zntrack/core/nodify.py - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status