iterative/dvc

View on GitHub

Showing 399 of 443 total issues

Function show has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def show(
    repo: "Repo",
    all_branches=False,
    all_tags=False,
    revs: Union[List[str], str, None] = None,
Severity: Minor
Found in dvc/repo/experiments/show.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 resolve_name has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_name(
    scm: "Git",
    exp_names: Union[Iterable[str], str],
    git_remote: Optional[str] = None,
) -> Dict[str, Optional[ExpRefInfo]]:
Severity: Minor
Found in dvc/repo/experiments/utils.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 apply has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def apply(repo, rev, force=True, **kwargs):
    from scmrepo.exceptions import MergeConflictError

    from dvc.repo.checkout import checkout as dvc_checkout
    from dvc.scm import RevError, SCMError, resolve_rev
Severity: Minor
Found in dvc/repo/experiments/apply.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 _sort_column has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def _sort_column(sort_by, metric_names, param_names):
    path, _, sort_name = sort_by.rpartition(":")
    matches = set()

    if path:
Severity: Minor
Found in dvc/commands/experiments/show.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

URLInfo has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class URLInfo(_BasePath):
    DEFAULT_PORTS = {"http": 80, "https": 443, "ssh": 22, "hdfs": 0}

    def __init__(self, url):
        p = urlparse(url)
Severity: Minor
Found in dvc/testing/path_info.py - About 2 hrs to fix

    TmpDir has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TmpDir(pathlib.Path):
        scheme = "local"
    
        @property
        def fs_path(self):
    Severity: Minor
    Found in dvc/testing/tmp_dir.py - About 2 hrs to fix

      Function init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def init(
          repo: "Repo",
          name: str = "train",
          type: str = "default",  # pylint: disable=redefined-builtin
          defaults: Dict[str, str] = None,
      Severity: Minor
      Found in dvc/repo/experiments/init.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_steps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_steps(G, stages, downstream, single_item):
          import networkx as nx
      
          active = G.copy()
          if not single_item:
      Severity: Minor
      Found in dvc/repo/reproduce.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 commit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def commit(
              cls,
              scm: "Git",
              exp_hash: str,
              exp_name: Optional[str] = None,
      Severity: Minor
      Found in dvc/repo/experiments/executor/base.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 _stash_exp has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _stash_exp(
              self,
              *args,
              params: Optional[dict] = None,
              resume_rev: Optional[str] = None,
      Severity: Minor
      Found in dvc/repo/experiments/__init__.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 _check_circular_import has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_circular_import(self, odb, obj_ids):
              from dvc.exceptions import CircularImportError
              from dvc.fs.dvc import DvcFileSystem
              from dvc_data.db.reference import ReferenceObjectDB
              from dvc_data.tree import Tree
      Severity: Minor
      Found in dvc/dependency/repo.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 path_info.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # pylint: disable=protected-access
      import os
      import pathlib
      import posixpath
      from typing import Callable
      Severity: Minor
      Found in dvc/testing/path_info.py - About 2 hrs to fix

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

        import os
        from urllib.parse import urlparse
        
        from funcy import walk_values
        from voluptuous import (
        Severity: Minor
        Found in dvc/config_schema.py - About 2 hrs to fix

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

          def add_parser(subparsers, parent_parser):
              from dvc.commands.config import parent_config_parser
          
              machine_HELP = "Set up and manage cloud machines."
              machine_parser = subparsers.add_parser(
          Severity: Major
          Found in dvc/commands/machine.py - About 2 hrs to fix

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

            def _ast_assign_to_dict(assign, only_self_params=False, lineno=False):
                result = {}
            
                if isinstance(assign, ast.AnnAssign):
                    name = _get_ast_name(assign.target, only_self_params)
            Severity: Minor
            Found in dvc/utils/serialize/_py.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 parse_target has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_target(
                target: str, default: str = None, isa_glob: bool = False
            ) -> Tuple[Optional[str], Optional[str]]:
                from dvc.dvcfile import PIPELINE_FILE, PIPELINE_LOCK, is_valid_filename
                from dvc.exceptions import DvcException
            Severity: Minor
            Found in dvc/utils/__init__.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 ls has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def ls(  # pylint: disable=arguments-differ
                    self, path, detail=True, dvc_only=False, **kwargs
                ):
                    fs, fs_path, dvc_fs, dvc_path = self._get_fs_pair(path)
            
            
            Severity: Minor
            Found in dvc/fs/dvc.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 __init__.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import csv
            import io
            import logging
            import os
            from collections import OrderedDict
            Severity: Minor
            Found in dvc/repo/plots/__init__.py - About 2 hrs to fix

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

              def makedirs(path, exist_ok=False, mode=None):
                  if mode is None:
                      os.makedirs(path, exist_ok=exist_ok)
                      return
              
              
              Severity: Minor
              Found in dvc/utils/fs.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 send_signal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def send_signal(self, name: str, sig: int):
                      """Send `signal` to the specified named process."""
                      process_info = self[name]
                      if sys.platform == "win32":
                          if sig not in (
              Severity: Minor
              Found in dvc/proc/manager.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