zincware/ZnTrack

View on GitHub

Showing 50 of 50 total issues

Avoid too many return statements within this function.
Open

        return obj.__module__
Severity: Major
Found in zntrack/utils/__init__.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

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

      Avoid too many return statements within this function.
      Open

          return pathlib.Path(sys.argv[0]).stem
      Severity: Major
      Found in zntrack/utils/__init__.py - About 30 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 __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

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

        def update_config_file(
            file: pathlib.Path,
            node_name: typing.Union[str, None],
            value_name: typing.Union[str, None],
            value,
        Severity: Minor
        Found in zntrack/utils/file_io.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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def default(self, value, **kwargs):
                """Replace the nwd placeholder with the actual nwd."""
                if isinstance(value, str):
                    if value == nwd:
                        # nwd is of type str but will be converted to pathlib.Path
        Severity: Minor
        Found in zntrack/utils/node_wd.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):
                """Disable the _graph_ in the value 'Node'."""
                if value is None:
                    return super().__set__(instance, value)
        
        
        Severity: Minor
        Found in zntrack/fields/dependency.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def save(self, instance: "Node"):
                """Save the Node parameters to disk."""
                try:
                    value = self.get_value_except_lazy(instance)
                except DataIsLazyError:
        Severity: Minor
        Found in zntrack/fields/zn/options.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

        Severity
        Category
        Status
        Source
        Language