iterative/dvc

View on GitHub

Showing 419 of 497 total issues

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

class SSHFileSystem(BaseFileSystem):  # pylint:disable=abstract-method
    scheme = Schemes.SSH
    REQUIRES = {"paramiko": "paramiko"}
    _JOBS = 4

Severity: Minor
Found in dvc/fs/ssh/__init__.py - About 2 hrs to fix

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

    import os
    from abc import ABC, abstractmethod
    from typing import (
        TYPE_CHECKING,
        Callable,
    Severity: Minor
    Found in dvc/scm/git/backend/base.py - About 2 hrs to fix

      File checkout.py has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      
      from shortuuid import uuid
      
      from dvc import prompt
      Severity: Minor
      Found in dvc/checkout.py - About 2 hrs to fix

        Function _show_diff has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _show_diff(diff, hide_missing=False):
                """
                Given a diff structure, generate a string of paths separated
                by new lines and grouped together by their state.
        
        
        Severity: Minor
        Found in dvc/command/diff.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 ls has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def ls(repo, *args, rev=None, git_remote=None, all_=False, **kwargs):
            from dvc.scm.git import Git
        
            if rev:
                try:
        Severity: Minor
        Found in dvc/repo/experiments/ls.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 _calculate_column_widths has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _calculate_column_widths(
                self, console: "Console", options: "ConsoleOptions"
            ) -> List[int]:
                """Calculate the widths of each column, including padding, not
                including borders.
        Severity: Minor
        Found in dvc/utils/table.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 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        import os
        from typing import TYPE_CHECKING, Dict, List, Optional
        
        from funcy import cached_property, first, project
        Severity: Minor
        Found in dvc/repo/plots/__init__.py - About 2 hrs to fix

          LocalFileSystem has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class LocalFileSystem(BaseFileSystem):
              scheme = Schemes.LOCAL
              PATH_CLS = PathInfo
              PARAM_CHECKSUM = "md5"
              PARAM_PATH = "path"
          Severity: Minor
          Found in dvc/fs/local.py - About 2 hrs to fix

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

                def reproduce(
                    cls,
                    dvc_dir: Optional[str],
                    rev: str,
                    queue: Optional["Queue"] = None,
            Severity: Minor
            Found in dvc/repo/experiments/executor/base.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 connection.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import errno
            import logging
            import os
            import posixpath
            import shlex
            Severity: Minor
            Found in dvc/fs/ssh/connection.py - About 2 hrs to fix

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

              def checkout(
                  path_info,
                  fs,
                  obj,
                  cache,
              Severity: Minor
              Found in dvc/checkout.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 _clone_default_branch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              def _clone_default_branch(url, rev, for_write=False):
                  """Get or create a clean clone of the url.
              
                  The cloned is reactualized with git pull unless rev is a known sha.
                  """
              Severity: Minor
              Found in dvc/external_repo.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 22 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

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

                class FSSpecWrapper(BaseFileSystem):
                    TRAVERSE_PREFIX_LEN = 2
                
                    def __init__(self, **kwargs):
                        super().__init__(**kwargs)
                Severity: Minor
                Found in dvc/fs/fsspec_wrapper.py - About 2 hrs to fix

                  File utils.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import os
                  import pathlib
                  from contextlib import suppress
                  from typing import TYPE_CHECKING, Union
                  
                  
                  Severity: Minor
                  Found in dvc/stage/utils.py - About 2 hrs to fix

                    Function commit has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def commit(
                            cls,
                            scm: "Git",
                            exp_hash: str,
                            exp_name: Optional[str] = None,
                    Severity: Minor
                    Found in dvc/repo/experiments/executor/base.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 _stash_exp has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _stash_exp(
                            self,
                            *args,
                            params: Optional[dict] = None,
                            resume_rev: Optional[str] = None,
                    Severity: Minor
                    Found in dvc/repo/experiments/__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 apply has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def apply(repo, rev, force=True, **kwargs):
                        from dvc.repo.checkout import checkout as dvc_checkout
                        from dvc.scm.base import MergeConflictError, SCMError
                    
                        exps = repo.experiments
                    Severity: Minor
                    Found in dvc/repo/experiments/apply.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 checkout_index has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def checkout_index(
                            self,
                            paths: Optional[Iterable[str]] = None,
                            force: bool = False,
                            ours: bool = False,
                    Severity: Minor
                    Found in dvc/scm/git/backend/gitpython.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 _get_steps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _get_steps(G, stages, downstream, single_item):
                        import networkx as nx
                    
                        active = G.copy()
                        if not single_item:
                    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

                    Severity
                    Category
                    Status
                    Source
                    Language