iterative/dvc

View on GitHub

Showing 104 of 225 total issues

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

    def download(
        self,
        from_infos,
        to_infos,
        no_progress_bar=False,
Severity: Minor
Found in dvc/remote/azure.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

            try:
                bucket = gs.bucket(from_info["bucket"])
                blob = bucket.get_blob(from_info["path"])
                blob.download_to_filename(tmp_file)
            except Exception:
Severity: Major
Found in dvc/remote/gs.py and 1 other location - About 1 hr to fix
dvc/remote/gs.py on lines 143..154

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

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

            try:
                bucket = gs.bucket(to_info["bucket"])
                blob = bucket.blob(to_info["path"])
                blob.upload_from_filename(from_info["path"])
            except Exception:
Severity: Major
Found in dvc/remote/gs.py and 1 other location - About 1 hr to fix
dvc/remote/gs.py on lines 197..208

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

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

    def islink(self, path):
        from stat import S_ISLNK

        self._sftp_connect()
        try:
Severity: Major
Found in dvc/remote/ssh/connection.py and 2 other locations - About 1 hr to fix
dvc/remote/ssh/connection.py on lines 80..87
dvc/remote/ssh/connection.py on lines 89..96

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

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 isdir(self, path):
        from stat import S_ISDIR

        self._sftp_connect()
        try:
Severity: Major
Found in dvc/remote/ssh/connection.py and 2 other locations - About 1 hr to fix
dvc/remote/ssh/connection.py on lines 89..96
dvc/remote/ssh/connection.py on lines 98..105

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

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 isfile(self, path):
        from stat import S_ISREG

        self._sftp_connect()
        try:
Severity: Major
Found in dvc/remote/ssh/connection.py and 2 other locations - About 1 hr to fix
dvc/remote/ssh/connection.py on lines 80..87
dvc/remote/ssh/connection.py on lines 98..105

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

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

    def collect_dir_cache(self, dname):
        dir_info = []

        for root, dirs, files in os.walk(str(dname)):
            bar = False
Severity: Minor
Found in dvc/remote/local.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 pull has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

                        logger.error(
                            "failed to upload '{host}/{path}' to '{dest}'".format(
                                host=from_info["host"],
                                path=from_info["path"],
                                dest=to_info["path"],
    Severity: Major
    Found in dvc/remote/ssh/__init__.py and 2 other locations - About 1 hr to fix
    dvc/remote/ssh/__init__.py on lines 147..151
    dvc/remote/ssh/__init__.py on lines 160..164

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

    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 reproduce has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

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

                  logger.debug(
                      "Downloading '{host}/{path}' to '{dest}'".format(
                          host=from_info["host"],
                          path=from_info["path"],
                          dest=to_info["path"],
      Severity: Major
      Found in dvc/remote/ssh/__init__.py and 2 other locations - About 1 hr to fix
      dvc/remote/ssh/__init__.py on lines 160..164
      dvc/remote/ssh/__init__.py on lines 187..191

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

      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

                      logger.error(
                          "failed to download '{host}/{path}' to '{dest}'".format(
                              host=from_info["host"],
                              path=from_info["path"],
                              dest=to_info["path"],
      Severity: Major
      Found in dvc/remote/ssh/__init__.py and 2 other locations - About 1 hr to fix
      dvc/remote/ssh/__init__.py on lines 147..151
      dvc/remote/ssh/__init__.py on lines 187..191

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

      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 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 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 _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 push has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def push(
            Severity: Major
            Found in dvc/repo/push.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 status has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

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

                      def changed_cache(self, md5):
                          cache = self.get(md5)
                          clist = [(cache, md5)]
                  
                          while True:
                  Severity: Minor
                  Found in dvc/remote/local.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):
                          recursive = not self.args.single_item
                          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

                  Severity
                  Category
                  Status
                  Source
                  Language