zincware/ZnTrack

View on GitHub

Showing 50 of 50 total issues

File options.py has 430 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Base classes for 'zntrack.<field>' fields."""

import dataclasses
import json
import logging
Severity: Minor
Found in zntrack/fields/zn/options.py - About 6 hrs to fix

    File zntrack_project.py has 417 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """The class for the ZnTrackProject."""
    
    from __future__ import annotations
    
    import contextlib
    Severity: Minor
    Found in zntrack/project/zntrack_project.py - About 6 hrs to fix

      Function run has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(
              self,
              eager=False,
              repro: bool = True,
              optional: dict = None,
      Severity: Minor
      Found in zntrack/project/zntrack_project.py - About 5 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

      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

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

              def get_files(self, instance) -> list:
                  """Get the affected files of the respective Nodes."""
                  files = []
          
                  value = getattr(instance, self.name)
          Severity: Minor
          Found in zntrack/fields/zn/options.py - About 3 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 jupyter_class_to_file has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          def jupyter_class_to_file(nb_name, module_name):
              """Extract the class definition form an ipynb file."""
              # TODO is it really module_name and not class name?
          
              log_jupyter_warning()
          Severity: Minor
          Found in zntrack/notebooks/jupyter.py - About 3 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 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 save has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              def save(self, instance: "Node"):
                  """Save plots options to dvc.yaml, if use_global_plots is True."""
                  if self.plots_options.get("--template") is not None:
                      template = pathlib.Path(self.plots_options["--template"]).resolve()
                      if pathlib.Path.cwd() not in template.parents:
          Severity: Minor
          Found in zntrack/fields/field.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_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 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

          File field.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """The base class for all fields."""
          
          import abc
          import contextlib
          import enum
          Severity: Minor
          Found in zntrack/fields/field.py - About 2 hrs to fix

            Function auto_remove has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def auto_remove(self, remove_empty_dirs=True):
                    """Remove all nodes from 'dvc.yaml' that are not in the graph."""
                    _, dvc_node_names = get_groups(None, None)
                    graph_node_names = [self.graph.nodes[x]["value"].name for x in self.graph.nodes]
            
            
            Severity: Minor
            Found in zntrack/project/zntrack_project.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_groups has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_groups(remote, rev) -> (dict, list):
                """Get the group names and the nodes in each group from the remote.
            
                Arguments:
                ---------
            Severity: Minor
            Found in zntrack/utils/cli.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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def run(
                node: str, name: str = None, meta_only: bool = False, method: str = "run"
            ) -> None:
                """Execute a ZnTrack Node.
            
            
            Severity: Minor
            Found in zntrack/cli/__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 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 from_rev has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def from_rev(name, remote=".", rev=None, **kwargs) -> T:
                """Load a ZnTrack Node by its name.
            
                Parameters
                ----------
            Severity: Minor
            Found in zntrack/core/load.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_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 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
                Severity
                Category
                Status
                Source
                Language