iterative/dvc

View on GitHub
dvc/repo/__init__.py

Summary

Maintainability
B
6 hrs
Test Coverage

File __init__.py has 409 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import logging
import os
from collections import defaultdict
from contextlib import contextmanager
from functools import wraps
Severity: Minor
Found in dvc/repo/__init__.py - About 5 hrs to fix

    Repo has 33 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    class Repo:
        DVC_DIR = ".dvc"
    
        from dvc.repo.add import add  # type: ignore[misc]
        from dvc.repo.checkout import checkout  # type: ignore[misc]
    Severity: Minor
    Found in dvc/repo/__init__.py - About 4 hrs to fix

      Function used_objs has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def used_objs(
      Severity: Major
      Found in dvc/repo/__init__.py - About 1 hr to fix

        Function _get_repo_dirs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_repo_dirs(
                self,
                root_dir: str = None,
                fs: "FileSystem" = None,
                uninitialized: bool = False,
        Severity: Minor
        Found in dvc/repo/__init__.py - About 1 hr 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 __init__ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

            def __init__(
                self,
                root_dir=None,
                fs=None,
                rev=None,
        Severity: Minor
        Found in dvc/repo/__init__.py - About 1 hr to fix

          Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in dvc/repo/__init__.py - About 1 hr to fix

            Function find_root has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def find_root(cls, root=None, fs=None) -> str:
                    from dvc.fs import LocalFileSystem, localfs
            
                    fs = fs or localfs
                    root = root or os.curdir
            Severity: Minor
            Found in dvc/repo/__init__.py - About 1 hr 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 find_outs_by_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def find_outs_by_path(self, path, outs=None, recursive=False, strict=True):
                    # using `outs_graph` to ensure graph checks are run
                    outs = outs or self.index.outs_graph
            
                    abs_path = self.fs.path.abspath(path)
            Severity: Minor
            Found in dvc/repo/__init__.py - About 55 mins 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 used_objs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def used_objs(
                    self,
                    targets=None,
                    all_branches=False,
                    with_deps=False,
            Severity: Minor
            Found in dvc/repo/__init__.py - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status