iterative/dvc

View on GitHub

Showing 157 of 253 total issues

RemoteBASE has 63 functions (exceeds 20 allowed). Consider refactoring.
Open

class RemoteBASE(object):
    scheme = "base"
    path_cls = URLInfo
    REQUIRES = {}
    JOBS = 4 * cpu_count()
Severity: Major
Found in dvc/remote/base.py - About 1 day to fix

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

    def add_parser(subparsers, parent_parser):
        CHECKOUT_HELP = "Checkout data files from cache."
    
        checkout_parser = subparsers.add_parser(
            "checkout",
    Severity: Major
    Found in dvc/command/checkout.py and 1 other location - About 1 day to fix
    dvc/command/commit.py on lines 36..73

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

    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 add_parser(subparsers, parent_parser):
        COMMIT_HELP = "Save changed data to cache and update DVC-files."
    
        commit_parser = subparsers.add_parser(
            "commit",
    Severity: Major
    Found in dvc/command/commit.py and 1 other location - About 1 day to fix
    dvc/command/checkout.py on lines 23..60

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

    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 CmdDataPush(CmdDataBase):
        def run(self):
            try:
                processed_files_count = self.repo.push(
                    targets=self.args.targets,
    Severity: Major
    Found in dvc/command/data_sync.py and 1 other location - About 6 hrs to fix
    dvc/command/data_sync.py on lines 59..75

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

    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 CmdDataFetch(CmdDataBase):
        def run(self):
            try:
                processed_files_count = self.repo.fetch(
                    targets=self.args.targets,
    Severity: Major
    Found in dvc/command/data_sync.py and 1 other location - About 6 hrs to fix
    dvc/command/data_sync.py on lines 40..56

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

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

    from __future__ import unicode_literals
    
    import os
    import logging
    from contextlib import contextmanager
    Severity: Minor
    Found in dvc/repo/__init__.py - About 5 hrs to fix

      Function _collect_graph has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Git has 40 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Git(Base):
          """Class for managing Git."""
      
          GITIGNORE = ".gitignore"
          GIT_DIR = ".git"
      Severity: Minor
      Found in dvc/scm/git/__init__.py - About 5 hrs to fix

        Function _do_draw has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

            def _do_draw(self, screen):  # pragma: no cover
                # pylint: disable=too-many-locals
                # pylint: disable=too-many-branches, too-many-statements
                from dvc.system import System
                from asciimatics.event import KeyboardEvent
        Severity: Minor
        Found in dvc/dagascii.py - About 5 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 apply_diff has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        def apply_diff(src, dest):
            """Recursively apply changes from src to dest.
        
            Preserves dest type and hidden info in dest structure,
            like ruamel.yaml leaves when parses files. This includes comments,
        Severity: Minor
        Found in dvc/utils/collections.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 run has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self, dry=False, no_commit=False, force=False):
                if (self.cmd or self.is_import) and not self.locked and not dry:
                    self.remove_outs(ignore_remove=False, force=False)
        
                if self.locked:
        Severity: Minor
        Found in dvc/stage.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 324 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 3 hrs to fix

          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

          File base.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from __future__ import unicode_literals
          
          import logging
          from copy import copy
          
          
          Severity: Minor
          Found in dvc/output/base.py - About 3 hrs to fix

            Function line has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                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

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

                def move(self, from_info, to_info):
                    if from_info.scheme != self.scheme or 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 3 hrs to fix
            dvc/remote/ssh/__init__.py on lines 206..211

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

            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 reflink(self, from_info, to_info):
                    if from_info.scheme != self.scheme or 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 3 hrs to fix
            dvc/remote/ssh/__init__.py on lines 220..225

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

            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 27 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 3 hrs to fix

              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

                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 179..184

                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

                Severity
                Category
                Status
                Source
                Language