iterative/dvc

View on GitHub
dvc/repo/index.py

Summary

Maintainability
F
1 wk
Test Coverage

Function _load_data_from_tree has a Cognitive Complexity of 322 (exceeds 5 allowed). Consider refactoring.
Open

def _load_data_from_tree(index, prefix, ws, key, tree, hash_name):
    from dvc_data.index import DataIndexEntry, Meta

    parents = set()

Severity: Minor
Found in dvc/repo/index.py - About 6 days 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 index.py has 737 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import time
from collections import defaultdict
from collections.abc import Iterable, Iterator
from functools import partial
Severity: Major
Found in dvc/repo/index.py - About 1 day to fix

    Function collect_files has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def collect_files(
        repo: "Repo", onerror: Optional[Callable[[str, Exception], None]] = None
    ):
        """Collects all of the stages present in the DVC repo.
    
    
    Severity: Minor
    Found in dvc/repo/index.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 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Function build_data_index has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def build_data_index(  # noqa: C901, PLR0912
      Severity: Major
      Found in dvc/repo/index.py - About 50 mins to fix

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

            def used_objs(
        Severity: Major
        Found in dvc/repo/index.py - About 50 mins to fix

          Function _load_data_from_tree has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _load_data_from_tree(index, prefix, ws, key, tree, hash_name):
          Severity: Minor
          Found in dvc/repo/index.py - About 45 mins to fix

            Function targets_view has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def targets_view(
            Severity: Minor
            Found in dvc/repo/index.py - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status