zincware/ZnTrack

View on GitHub

Showing 50 of 50 total issues

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 timeit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def timeit(field: str):
    """Decorator to time a function.

    Attributes
    ----------
Severity: Minor
Found in zntrack/tools/__init__.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_optional_dvc_cmd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get_optional_dvc_cmd(
        self, instance: "Node", git_only_repo: bool
    ) -> typing.List[list]:
        """Get the dvc command for this field."""
        nodes = getattr(instance, self.name)
Severity: Minor
Found in zntrack/fields/zn/options.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 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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in zntrack/fields/field.py - About 1 hr to fix

    Function __set__ has a Cognitive Complexity of 10 (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/zn/options.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 __init__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            *args,
            template=None,
            x=None,
    Severity: Minor
    Found in zntrack/fields/field.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 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 run has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def run(
      Severity: Major
      Found in zntrack/project/zntrack_project.py - About 50 mins 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 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

            Consider simplifying this complex logical expression.
            Open

                            if (
                                re.match(r"\S", line)
                                and not line.startswith("#")
                                and not line.startswith("class")
                                and not line.startswith("def")
            Severity: Major
            Found in zntrack/notebooks/jupyter.py - About 40 mins to fix

              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 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 get_optional_dvc_cmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get_optional_dvc_cmd(
                          self, instance: "Node", git_only_repo: bool
                      ) -> typing.List[typing.List[str]]:
                          """Add 'dvc plots modify' to this option."""
                          if not self.use_global_plots:
                  Severity: Minor
                  Found in zntrack/fields/field.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 module_handler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def module_handler(obj) -> str:
                      """Get the module for the Node.
                  
                      There are three cases that have to be handled here:
                          1. Run from __main__ should not have __main__ as module but
                  Severity: Minor
                  Found in zntrack/utils/__init__.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 group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def group(self, *names: typing.List[str]):
                          """Group nodes together.
                  
                          Parameters
                          ----------
                  Severity: Minor
                  Found in zntrack/project/zntrack_project.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 _get_all_connections_and_instances has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def _get_all_connections_and_instances(value) -> list["Node"]:
                      """Get Nodes from Connections and CombinedConnections."""
                      connections = []
                      stack = [value]
                      while stack:
                  Severity: Minor
                  Found in zntrack/fields/zn/options.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 __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

                  Severity
                  Category
                  Status
                  Source
                  Language