iterative/dvc

View on GitHub

Showing 101 of 233 total issues

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

def iter_url(url, chunk_size=io.DEFAULT_BUFFER_SIZE):
    """Iterate over chunks requested from url."""

    def request(headers=None):
        the_url = url() if callable(url) else url
Severity: Minor
Found in dvc/utils/http.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 gc has a Cognitive Complexity of 15 (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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self, cmd):
        stdin, stdout, stderr = self._ssh.exec_command(cmd)
        channel = stdout.channel

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

def _read_metrics(repo, metrics, branch):
    """Read the content of each metric file and format it.

    Args:
        metrics (list): List of metric touples
Severity: Minor
Found in dvc/repo/metrics/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 _show has a Cognitive Complexity of 12 (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 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 12 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self):
        if not self.exists:
            raise self.DoesNotExistError(self)

        if not self.isfile and not self.isdir:
Severity: Minor
Found in dvc/output/base.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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def show(
    repo,
    targets=None,
    typ=None,
    xpath=None,
Severity: Minor
Found in dvc/repo/metrics/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 fspath has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def fspath(path):
        """Return the path representation of a path-like object.

        If str or bytes is passed in, it is returned unchanged. Otherwise the
        os.PathLike interface is used to get the path representation. If the
Severity: Minor
Found in dvc/utils/compat.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 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in dvc/stage.py - About 1 hr to fix

    Function gc has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function used_cache has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function _load_all_used_cache has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

          Function pull has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function fetch has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                  def run(self):
                      msg = "this will remove all cache except the cache that is used in "
                      if not self.args.all_branches and not self.args.all_tags:
                          msg += "the current git branch"
                      elif self.args.all_branches and not self.args.all_tags:
              Severity: Minor
              Found in dvc/command/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 _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 _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 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 open_max_sftp_channels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def open_max_sftp_channels(self):
                      # If there are more than 1 it means we've already opened max amount
                      if len(self._sftp_channels) <= 1:
                          while True:
                              try:
              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

              Severity
              Category
              Status
              Source
              Language