iterative/dvc

View on GitHub

Showing 139 of 233 total issues

File __init__.py has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Helpers for other modules."""

from __future__ import unicode_literals

from dvc.utils.compat import (
Severity: Minor
Found in dvc/utils/__init__.py - About 2 hrs to fix

    File data_sync.py has 282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import unicode_literals
    
    import argparse
    import logging
    
    
    Severity: Minor
    Found in dvc/command/data_sync.py - About 2 hrs to fix

      Function reproduce has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

      def reproduce(
          self,
          target=None,
          recursive=False,
          pipeline=False,
      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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      def add_parser(subparsers, parent_parser):
          ROOT_HELP = "Relative path to the repository's directory."
          root_parser = subparsers.add_parser(
              "root",
              parents=[parent_parser],
      Severity: Major
      Found in dvc/command/root.py and 2 other locations - About 2 hrs to fix
      dvc/command/install.py on lines 22..31
      dvc/command/version.py on lines 105..115

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      def add_parser(subparsers, parent_parser):
          INSTALL_HELP = "Install DVC git hooks into the repository."
          install_parser = subparsers.add_parser(
              "install",
              parents=[parent_parser],
      Severity: Major
      Found in dvc/command/install.py and 2 other locations - About 2 hrs to fix
      dvc/command/root.py on lines 19..28
      dvc/command/version.py on lines 105..115

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 56.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      class SSHConnection:
          def __init__(self, host, *args, **kwargs):
              logger.debug(
                  "Establishing ssh connection with '{host}' "
                  "through port '{port}' as user '{username}'".format(
      Severity: Minor
      Found in dvc/remote/ssh/connection.py - About 2 hrs to fix

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

        def _makedirs(name, mode=0o777, exist_ok=False):
            """Source: https://github.com/python/cpython/blob/
                3ce3dea60646d8a5a1c952469a2eb65f937875b3/Lib/os.py#L196-L226
            """
            head, tail = os.path.split(name)
        Severity: Minor
        Found in dvc/utils/compat.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 used_cache has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def used_cache(
                self,
                target=None,
                all_branches=False,
                active=True,
        Severity: Minor
        Found in dvc/repo/__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

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

        class URLInfo(object):
            DEFAULT_PORTS = {"http": 80, "https": 443, "ssh": 22, "hdfs": 0}
        
            def __init__(self, url):
                self.parsed = urlparse(url)
        Severity: Minor
        Found in dvc/path_info.py - About 2 hrs to fix

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

              def stages(self, from_directory=None, check_dag=True):
                  """
                  Walks down the root directory looking for Dvcfiles,
                  skipping the directories that are related with
                  any SCM (e.g. `.git`), DVC itself (`.dvc`), or directories
          Severity: Minor
          Found in dvc/repo/__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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          class CircularDependencyError(DvcException):
              """Thrown if a file/directory specified both as an output and as a
              dependency.
          
              Args:
          Severity: Major
          Found in dvc/exceptions.py and 1 other location - About 2 hrs to fix
          dvc/exceptions.py on lines 111..122

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          class ArgumentDuplicationError(DvcException):
              """Thrown if a file/directory is specified as a dependency/output more
              than once.
          
              Args:
          Severity: Major
          Found in dvc/exceptions.py and 1 other location - About 2 hrs to fix
          dvc/exceptions.py on lines 93..108

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _download(
                  self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
              ):
                  cb = None if no_progress_bar else Callback(name)
                  self.blob_service.get_blob_to_path(
          Severity: Major
          Found in dvc/remote/azure.py and 1 other location - About 1 hr to fix
          dvc/remote/azure.py on lines 122..127

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 49.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _upload(
                  self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
              ):
                  cb = None if no_progress_bar else Callback(name)
                  self.blob_service.create_blob_from_path(
          Severity: Major
          Found in dvc/remote/azure.py and 1 other location - About 1 hr to fix
          dvc/remote/azure.py on lines 130..135

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 49.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _upload(
                  self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
              ):
                  cb = None if no_progress_bar else Callback(name)
                  self.oss_service.put_object_from_file(
          Severity: Major
          Found in dvc/remote/oss.py and 1 other location - About 1 hr to fix
          dvc/remote/oss.py on lines 115..120

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _download(
                  self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
              ):
                  cb = None if no_progress_bar else Callback(name)
                  self.oss_service.get_object_to_file(
          Severity: Major
          Found in dvc/remote/oss.py and 1 other location - About 1 hr to fix
          dvc/remote/oss.py on lines 107..112

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _upload(self, from_file, to_info, **_kwargs):
                  bucket = self.gs.bucket(to_info.bucket)
                  blob = bucket.blob(to_info.path)
                  blob.upload_from_filename(from_file)
          Severity: Major
          Found in dvc/remote/gs.py and 1 other location - About 1 hr to fix
          dvc/remote/gs.py on lines 108..111

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language