zincware/ZnTrack

View on GitHub
zntrack/core/node.py

Summary

Maintainability
C
1 day
Test Coverage

File node.py has 387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""The ZnTrack Node class."""

from __future__ import annotations

import contextlib
Severity: Minor
Found in zntrack/core/node.py - About 5 hrs to fix

    Function save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(
            self, parameter: bool = True, results: bool = True, meta_only: bool = False
        ) -> None:
            """Save the node's output to disk."""
            if meta_only:
    Severity: Minor
    Found in zntrack/core/node.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 get_dvc_cmd has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function from_rev has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def from_rev(
      Severity: Minor
      Found in zntrack/core/node.py - About 45 mins to fix

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

            def magic_patch(self) -> typing.ContextManager:
                """Patch the open function to use the Node's file system.
        
                Opening a relative path will use the Node's file system.
                Opening an absolute path will use the local file system.
        Severity: Minor
        Found in zntrack/core/node.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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def load(self, lazy: bool = None, results: bool = True) -> None:
                """Load the node's output from disk.
        
                Attributes
                ----------
        Severity: Minor
        Found in zntrack/core/node.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 __set__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __set__(self, instance, value):
                if value is None:
                    return
                if isinstance(value, NodeName):
                    if not instance._external_:
        Severity: Minor
        Found in zntrack/core/node.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