iterative/dvc

View on GitHub
dvc/scm.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function iter_revs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def iter_revs(
    scm: "Git",
    revs: Optional[list[str]] = None,
    num: int = 1,
    all_branches: bool = False,
Severity: Minor
Found in dvc/scm.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 _get_n_commits has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _get_n_commits(scm: "Git", revs: list[str], num: int) -> list[str]:
    results = []
    for rev in revs:
        if num == 0:
            continue
Severity: Minor
Found in dvc/scm.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 resolve_rev has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_rev(scm: Union["Git", "NoSCM"], rev: str) -> str:
    from scmrepo.exceptions import RevError as InternalRevError

    from dvc.repo.experiments.utils import fix_exp_head

Severity: Minor
Found in dvc/scm.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 iter_revs has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function update_git has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_git(self, event: "GitProgressEvent") -> None:
            phase, completed, total, message, *_ = event
            if phase:
                message = (phase + " | " + message) if message else phase
            if message:
    Severity: Minor
    Found in dvc/scm.py - About 45 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 lfs_prefetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def lfs_prefetch(fs: "FileSystem", paths: list[str]):
        from scmrepo.git.lfs import fetch as _lfs_fetch
    
        from dvc.fs.dvc import DVCFileSystem
        from dvc.fs.git import GitFileSystem
    Severity: Minor
    Found in dvc/scm.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