iterative/dvc

View on GitHub

Showing 106 of 245 total issues

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

    def run(self):
        saved_dir = os.path.realpath(os.curdir)
        if self.args.cwd:
            os.chdir(self.args.cwd)

Severity: Minor
Found in dvc/command/repro.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 _process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _process(
        self,
        checksum_infos,
        remote,
        jobs=None,
Severity: Minor
Found in dvc/remote/local/__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 walk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def walk(self, directory, topdown=True):
        # NOTE: original os.walk() implementation [1] with default options was
        # used as a template.
        #
        # [1] https://github.com/python/cpython/blob/master/Lib/os.py
Severity: Minor
Found in dvc/remote/ssh/connection.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 modify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def modify(repo, path, typ=None, xpath=None, delete=False):
    supported_types = ["raw", "json", "csv", "tsv", "hcsv", "htsv"]
    outs = repo.find_outs_by_path(path)
    assert len(outs) == 1
    out = outs[0]
Severity: Minor
Found in dvc/repo/metrics/modify.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 _merge_cache_lists has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _merge_cache_lists(clists):
    merged_cache = collections.defaultdict(list)

    for cache_list in clists:
        for scheme, cache in cache_list.items():
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 _cloud_status has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _cloud_status(
Severity: Major
Found in dvc/repo/status.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if url:
                parsed = urlparse(url)
                user_ssh_config = self._load_user_ssh_config(parsed.hostname)
    
                host = user_ssh_config.get("hostname", parsed.hostname)
    Severity: Major
    Found in dvc/remote/ssh/__init__.py - About 1 hr to fix

      Function remove_unused_links has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def remove_unused_links(self, used):
              """Removes all saved links except the ones that are used.
      
              Args:
                  used (list): list of used links that should not be removed.
      Severity: Minor
      Found in dvc/state.py - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def run(
          self,
          cmd=None,
          deps=None,
          outs=None,
      Severity: Minor
      Found in dvc/repo/run.py - About 55 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, repo, config):
              super(RemoteLOCAL, self).__init__(repo, config)
              self.state = self.repo.state if self.repo else None
              self.protected = config.get(Config.SECTION_CACHE_PROTECTED, False)
      
      
      Severity: Minor
      Found in dvc/remote/local/__init__.py - About 55 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 _checkout_dir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _checkout_dir(
              self, path_info, checksum, force, progress_callback=None
          ):
              # Create dir separately so that dir is created
              # even if there are no files in it
      Severity: Minor
      Found in dvc/remote/base.py - About 55 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 _show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _show(self, target, commands, outs, locked):
              import networkx
              from dvc.stage import Stage
      
              stage = Stage.load(self.repo, target)
      Severity: Minor
      Found in dvc/command/pipeline.py - About 55 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 _collect_metrics has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _collect_metrics(repo, path, recursive, typ, xpath, branch):
          """Gather all the metric outputs.
      
          Args:
              path (str): Path to a metric file or a directory.
      Severity: Minor
      Found in dvc/repo/metrics/show.py - About 55 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              if not self.args.targets:
                  self.args.targets = self.default_targets
      
              for target in self.args.targets:
      Severity: Minor
      Found in dvc/command/pipeline.py - About 55 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 _collect_used_dir_cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _collect_used_dir_cache(self, remote=None, force=False, jobs=None):
              """Get a list of `info`s retaled to the given directory.
      
              - Pull the directory entry from the remote cache if it was changed.
      
      
      Severity: Minor
      Found in dvc/output/base.py - About 55 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 show has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def show(
      Severity: Major
      Found in dvc/repo/metrics/show.py - About 50 mins to fix

        Function _get has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _get(stage, p, info, cache, metric, persist=False, tags=None):
        Severity: Major
        Found in dvc/output/__init__.py - About 50 mins to fix

          Function brancher has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def brancher(  # noqa: E302
          Severity: Minor
          Found in dvc/repo/brancher.py - About 45 mins to fix

            Function _remove_dir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def _remove_dir(self, path):
                    for root, dirs, files in self.walk(path, topdown=False):
                        for fname in files:
                            path = posixpath.join(root, fname)
                            self._remove_file(path)
            Severity: Minor
            Found in dvc/remote/ssh/connection.py - About 45 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 _download has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _download(
            Severity: Minor
            Found in dvc/remote/s3.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language