iterative/dvc

View on GitHub
dvc/repo/push.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function push has 14 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

def push(  # noqa: PLR0913
Severity: Major
Found in dvc/repo/push.py - About 1 hr to fix

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

    def push(  # noqa: PLR0913
        self,
        targets=None,
        jobs=None,
        remote=None,
    Severity: Minor
    Found in dvc/repo/push.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 _rebuild has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _rebuild(idx, path, fs, cb):
        from dvc_data.index import DataIndex, DataIndexEntry, Meta
    
        new = DataIndex()
        items = list(idx.items())
    Severity: Minor
    Found in dvc/repo/push.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

    Consider simplifying this complex logical expression.
    Open

            if (
                _remote
                and (_remote.worktree or _remote.fs.version_aware)
                and (revs or all_branches or all_tags or all_commits)
            ):
    Severity: Major
    Found in dvc/repo/push.py - About 1 hr to fix

      Function _update_meta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def _update_meta(index, **kwargs):
          from dvc.repo.worktree import _merge_push_meta, worktree_view_by_remotes
      
          stages = set()
          for remote_name, idx in worktree_view_by_remotes(index, push=True, **kwargs):
      Severity: Minor
      Found in dvc/repo/push.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