iterative/dvc

View on GitHub

Showing 158 of 247 total issues

RemoteSSH has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class RemoteSSH(RemoteBASE):
    scheme = Schemes.SSH
    REQUIRES = {"paramiko": paramiko}

    JOBS = 4
Severity: Minor
Found in dvc/remote/ssh/__init__.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 2 locations. Consider refactoring.
    Open

        def symlink(self, from_info, to_info):
            if not from_info.scheme == to_info.scheme == self.scheme:
                raise NotImplementedError
    
            with self.ssh(from_info) as ssh:
    Severity: Major
    Found in dvc/remote/ssh/__init__.py and 1 other location - About 2 hrs to fix
    dvc/remote/ssh/__init__.py on lines 175..180

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

    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 copy(self, from_info, to_info):
            if not from_info.scheme == to_info.scheme == self.scheme:
                raise NotImplementedError
    
            with self.ssh(from_info) as ssh:
    Severity: Major
    Found in dvc/remote/ssh/__init__.py and 1 other location - About 2 hrs to fix
    dvc/remote/ssh/__init__.py on lines 182..187

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

    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):
        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 115..125

    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 115..125

    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 __init__.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Manages Git."""
    
    from __future__ import unicode_literals
    
    import os
    Severity: Minor
    Found in dvc/scm/git/__init__.py - About 2 hrs to fix

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

      from __future__ import unicode_literals
      
      import errno
      import itertools
      import io
      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 _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 126..134

        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 _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 115..123

        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

        File data_sync.py has 262 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 used_cache has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def used_cache(
                  self,
                  targets=None,
                  all_branches=False,
                  with_deps=False,
          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

          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

          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

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

            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.oss_service.get_object_to_file(
            Severity: Major
            Found in dvc/remote/oss.py and 1 other location - About 2 hrs 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 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

            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

            Severity
            Category
            Status
            Source
            Language