dvc/repo/index.py
Function _load_data_from_tree
has a Cognitive Complexity of 322 (exceeds 5 allowed). Consider refactoring. Open
Open
def _load_data_from_tree(index, prefix, ws, key, tree, hash_name):
from dvc_data.index import DataIndexEntry, Meta
parents = set()
- Read upRead up
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
Open
import logging
import time
from collections import defaultdict
from collections.abc import Iterable, Iterator
from functools import partial
Function collect_files
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def collect_files(
repo: "Repo", onerror: Optional[Callable[[str, Exception], None]] = None
):
"""Collects all of the stages present in the DVC repo.
- Read upRead up
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
Open
def __init__(
Function build_data_index
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_data_index( # noqa: C901, PLR0912
Function used_objs
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def used_objs(
Function _load_data_from_tree
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _load_data_from_tree(index, prefix, ws, key, tree, hash_name):
Function targets_view
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def targets_view(