iterative/dvc

View on GitHub

Showing 400 of 444 total issues

Function dumpd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def dumpd(self):
        ret = {**self.hash_info.to_dict(), **self.meta.to_dict()}

        if self.is_in_repo:
            path = self.fs.path.as_posix(
Severity: Minor
Found in dvc/output.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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        name_only = self.args.name_only
        exps = self.repo.experiments.ls(
            all_commits=self.args.all_commits,
            rev=self.args.rev,
Severity: Minor
Found in dvc/commands/experiments/ls.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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        from dvc.exceptions import DvcException

        try:
            diff = self.repo.diff(
Severity: Minor
Found in dvc/commands/diff.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 test has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test(self, tmp_dir, dvc, remote):  # pylint: disable=W0613
        (stage,) = tmp_dir.dvc_gen("foo", "foo")
        out = stage.outs[0]
        cache = out.cache_path
        foo_hash = out.hash_info
Severity: Minor
Found in dvc/testing/test_remote.py - About 1 hr to fix

    Function add_parser has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def add_parser(subparsers, _parent_parser):
        from dvc.commands.status import CmdDataStatus
    
        # Pull
        PULL_HELP = "Download tracked files or directories from remote storage."
    Severity: Minor
    Found in dvc/commands/data_sync.py - About 1 hr to fix

      Function match_renderers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def match_renderers(
          plots_data,
          out: Optional["StrPath"] = None,
          templates_dir: Optional["StrPath"] = None,
      ):
      Severity: Minor
      Found in dvc/render/match.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 build_outs_trie has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def build_outs_trie(stages):
          outs = Trie()
      
          for stage in stages:
              for out in stage.outs:
      Severity: Minor
      Found in dvc/repo/trie.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 _collect_experiment_branch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _collect_experiment_branch(
          res, repo, branch, baseline, onerror: Optional[Callable] = None, **kwargs
      ):
          from dvc.scm import resolve_rev
      
      
      Severity: Minor
      Found in dvc/repo/experiments/show.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 _collect_from_revision has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _collect_from_revision(
              self,
              targets: Optional[List[str]] = None,
              revision: Optional[str] = None,
              recursive: bool = False,
      Severity: Minor
      Found in dvc/repo/plots/__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 check_arg_combinations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_arg_combinations(args):
          kwargs = args.kwargs
          invalid_opt = None
          to_remote = args.to_remote
          to_cache = kwargs.get("out") and not to_remote
      Severity: Minor
      Found in dvc/repo/add.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 validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def validate(*validators: Callable, post: bool = False):
          """
          Validate and transform arguments and results from function calls.
      
          The validators functions are passed a dictionary of arguments, which
      Severity: Minor
      Found in dvc/utils/collections.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 _show_markdown has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _show_markdown(diff, show_hash=False, hide_missing=False):
          headers = ["Status", "Hash", "Path"] if show_hash else ["Status", "Path"]
          rows = []
          statuses = ["added", "deleted", "renamed", "modified"]
          if not hide_missing:
      Severity: Minor
      Found in dvc/commands/diff.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 _collect_rows has 13 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _collect_rows(
      Severity: Major
      Found in dvc/commands/experiments/show.py - About 1 hr to fix

        Function gc has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def gc(
            self,
            all_branches=False,
            cloud=False,
            remote=None,
        Severity: Minor
        Found in dvc/repo/gc.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 __call__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def __call__(
                self,
                *args: Any,
                validator: Optional[
                    Callable[[str], Union[str, Tuple[str, str]]]
        Severity: Minor
        Found in dvc/ui/prompt.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 build_graph has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        def build_graph(stages, outs_trie=None):
            """Generate a graph by using the given stages on the given directory
        
            The nodes of the graph are the stage's path relative to the root.
        
        
        Severity: Minor
        Found in dvc/repo/graph.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 _gen has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _gen(self, struct, prefix=None):
                for name, contents in struct.items():
                    path = (prefix or self) / name
        
                    if isinstance(contents, dict):
        Severity: Minor
        Found in dvc/testing/cloud.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 shutdown has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def shutdown(self, wait=True, *, cancel_futures=False):
                if sys.version_info > (3, 9):
                    # pylint: disable=unexpected-keyword-arg
                    return super().shutdown(wait=wait, cancel_futures=cancel_futures)
        
        
        Severity: Minor
        Found in dvc/utils/threadpool.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 _gen has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def _gen(self, struct, prefix=None):
                paths = []
                for name, contents in struct.items():
                    path = (prefix or self) / name
        
        
        Severity: Minor
        Found in dvc/testing/tmp_dir.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 run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                from dvc.config import ConfigError
        
                if self.args.name is None and not self.args.unset:
                    conf = self.config.read(self.args.level)
        Severity: Minor
        Found in dvc/commands/remote.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

        Severity
        Category
        Status
        Source
        Language