iterative/dvc

View on GitHub

Showing 101 of 233 total issues

RemoteBASE has 55 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 7 hrs to fix

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

    from __future__ import unicode_literals
    
    from copy import copy
    
    from dvc.scheme import Schemes
    Severity: Minor
    Found in dvc/remote/local/__init__.py - About 6 hrs to fix

      Function graph has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def graph(self, stages=None, from_directory=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 6 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

      RemoteLOCAL has 43 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class RemoteLOCAL(RemoteBASE):
          scheme = Schemes.LOCAL
          path_cls = PathInfo
          PARAM_CHECKSUM = "md5"
          PARAM_PATH = "path"
      Severity: Minor
      Found in dvc/remote/local/__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

        File __init__.py has 383 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

          Git has 35 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 4 hrs to fix

            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

            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 __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
            
                    stage = Stage.load(self.repo, target)
            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

            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

            File base.py has 307 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

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

                    def used_cache(
                        self,
                        targets=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

                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

                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

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

                      Severity
                      Category
                      Status
                      Source
                      Language