zincware/ZnTrack

View on GitHub
zntrack/fields/dependency.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function get_files has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def get_files(self, instance) -> list:
        """Get the affected files of the respective Nodes."""
        files = []

        value, _ = self._get_nodes_on_off_graph(instance)
Severity: Minor
Found in zntrack/fields/dependency.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 _get_nodes_on_off_graph has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_nodes_on_off_graph(self, instance) -> t.Tuple[list, list]:
        """Get the nodes that are on the graph and off the graph.

        Get the values of this descriptor and split them into
        nodes that are on the graph and off the graph.
Severity: Minor
Found in zntrack/fields/dependency.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_stage_add_argument has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get_stage_add_argument(self, instance) -> t.List[tuple]:
        """Get the dvc command for this field."""
        cmd = [
            (f"--{self.dvc_option}", pathlib.Path(file).as_posix())
            for file in self.get_files(instance)
Severity: Minor
Found in zntrack/fields/dependency.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 _update_node_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_node_name(self, entry, instance, graph, key=None):
        """Update the node name if it is used as 'zn.nodes'.

        Attributes
        ----------
Severity: Minor
Found in zntrack/fields/dependency.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 _update_node_name has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _update_node_name(self, entry, instance, graph, key=None):
Severity: Minor
Found in zntrack/fields/dependency.py - About 35 mins to fix

    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

    There are no issues that match your filters.

    Category
    Status