iterative/dvc

View on GitHub

Showing 160 of 272 total issues

File gdrive.py has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import defaultdict
import os
import posixpath
import logging
import re
Severity: Minor
Found in dvc/remote/gdrive.py - About 5 hrs to fix

    Function _collect_graph has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Confirmed

        def _collect_graph(self, stages=None):
            """Generate a graph by using the given stages on the given directory
    
            The nodes of the graph are the stage's path relative to the root.
    
    
    Severity: Minor
    Found in dvc/repo/__init__.py - About 3 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 _build_graph has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def _build_graph(self, target, commands, outs):
            import networkx
            from dvc.stage import Stage
            from dvc.repo.graph import get_pipeline
    
    
    Severity: Minor
    Found in dvc/command/pipeline.py - About 3 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 StageFileIsNotDvcFileError(DvcException):
        def __init__(self, fname):
            msg = "'{}' is not a DVC-file".format(fname)
    
            sname = fname + Stage.STAGE_FILE_SUFFIX
    Severity: Major
    Found in dvc/stage.py and 1 other location - About 3 hrs to fix
    dvc/stage.py on lines 45..53

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

    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 StageFileDoesNotExistError(DvcException):
        def __init__(self, fname):
            msg = "'{}' does not exist.".format(fname)
    
            sname = fname + Stage.STAGE_FILE_SUFFIX
    Severity: Major
    Found in dvc/stage.py and 1 other location - About 3 hrs to fix
    dvc/stage.py on lines 62..70

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

    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 line has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Confirmed

        def line(self, x0, y0, x1, y1, char):
            """Create a line on ASCII canvas.
    
            Args:
                x0 (int): x coordinate where the line should start.
    Severity: Minor
    Found in dvc/dagascii.py - About 3 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 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Manages Git."""
    
    import logging
    import os
    import yaml
    Severity: Minor
    Found in dvc/scm/git/__init__.py - About 3 hrs to fix

      Function reproduce has a Cognitive Complexity of 19 (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

      Function list_cache_paths has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def list_cache_paths(self, prefix=None, progress_callback=None):
              if not self.exists(self.path_info):
                  return
      
              if prefix:
      Severity: Minor
      Found in dvc/remote/hdfs.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 273 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import errno
      import getpass
      import io
      import itertools
      import logging
      Severity: Minor
      Found in dvc/remote/ssh/__init__.py - About 2 hrs to fix

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

        def add_parser(subparsers, parent_parser):
            ROOT_HELP = "Return the relative path to the root of the DVC project."
            root_parser = subparsers.add_parser(
                "root",
                parents=[parent_parser],
        Severity: Major
        Found in dvc/command/root.py and 1 other location - About 2 hrs to fix
        dvc/command/version.py on lines 144..155

        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

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

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

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

          def add(repo, targets, recursive=False, no_commit=False, fname=None):
              if recursive and fname:
                  raise RecursiveAddingWhileUsingFilename()
          
              if isinstance(targets, str):
          Severity: Minor
          Found in dvc/repo/add.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

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

          class RemoteGDrive(RemoteBASE):
              scheme = Schemes.GDRIVE
              path_cls = GDriveURLInfo
              REQUIRES = {"pydrive2": "pydrive2"}
              DEFAULT_VERIFY = True
          Severity: Minor
          Found in dvc/remote/gdrive.py - About 2 hrs to fix

            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
                ):
                    with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                        self.blob_service.get_blob_to_path(
            Severity: Major
            Found in dvc/remote/azure.py and 1 other location - About 2 hrs to fix
            dvc/remote/azure.py on lines 121..129

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

            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
                ):
                    with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                        self.blob_service.create_blob_from_path(
            Severity: Major
            Found in dvc/remote/azure.py and 1 other location - About 2 hrs to fix
            dvc/remote/azure.py on lines 132..140

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

            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

            URLInfo has 21 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/path_info.py - About 2 hrs to fix

              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."""
                  import requests
              
                  def request(headers=None):
              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

              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
                  ):
                      with Tqdm(desc=name, disable=no_progress_bar, bytes=True) as pbar:
                          self.oss_service.put_object_from_file(
              Severity: Major
              Found in dvc/remote/oss.py and 1 other location - About 2 hrs to fix
              dvc/remote/oss.py on lines 119..124

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

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

                  def __init__(
                      self,
                      iterable=None,
                      disable=None,
                      level=logging.ERROR,
              Severity: Minor
              Found in dvc/progress.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

              Severity
              Category
              Status
              Source
              Language