File output.py
has 1212 lines of code (exceeds 250 allowed). Consider refactoring. Open
import errno
import os
import posixpath
from collections import defaultdict
from contextlib import suppress
Function dumpd
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def dumpd(self, **kwargs): # noqa: C901, PLR0912
from dvc.cachemgr import LEGACY_HASH_NAMES
ret: dict[str, Any] = {}
with_files = (
- 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
Output
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Output:
IS_DEPENDENCY = False
PARAM_PATH = "path"
PARAM_CACHE = "cache"
Function __init__
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__( # noqa: PLR0913
Function __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__( # noqa: PLR0913
self,
stage,
path,
info=None,
- 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 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__( # noqa: PLR0913
self,
stage,
path,
info=None,
Function _merge_data
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _merge_data(s_list):
d: dict[str, dict] = defaultdict(dict)
for key in s_list:
if isinstance(key, str):
d[key].update({})
- 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 loads_from
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def loads_from(
Function commit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def commit(self, filter_info=None, relink=True) -> None:
if not self.exists:
raise self.DoesNotExistError(self)
assert self.hash_info
- 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 _compute_meta_hash_info_from_files
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _compute_meta_hash_info_from_files(self) -> None:
if self.files:
tree = Tree.from_list(self.files, hash_name=self.hash_name)
tree.digest(with_meta=True)
- 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 checkout
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def checkout(
Function get_obj
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_obj(
self, filter_info: Optional[str] = None, **kwargs
) -> Optional["HashFile"]:
obj: Optional["HashFile"] = None
if self.obj:
- 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 transfer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def transfer(
Function split_file_meta_from_cloud
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def split_file_meta_from_cloud(entry: dict) -> dict:
if remote_name := entry.pop(Meta.PARAM_REMOTE, None):
remote_meta = {}
for key in (S3_PARAM_CHECKSUM, HDFS_PARAM_CHECKSUM, Meta.PARAM_VERSION_ID):
if value := entry.pop(key, None):
- 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 checkout
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def checkout(
self,
force: bool = False,
progress_callback: "Callback" = DEFAULT_CALLBACK,
relink: bool = False,
- 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 add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add( # noqa: C901
Function _collect_used_dir_cache
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _collect_used_dir_cache(
Avoid too many return
statements within this function. Open
return self.fs.relpath(self.fs_path, self.repo.root_dir)
Function get_dir_cache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_dir_cache(self, **kwargs) -> Optional["Tree"]:
if not self.is_dir_checksum:
raise DvcException("cannot get dir cache for file checksum")
obj = self.cache.get(self.hash_info.value)
- 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 _collect_used_dir_cache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _collect_used_dir_cache(
self, remote=None, force=False, jobs=None, filter_info=None
) -> Optional["Tree"]:
"""Fetch dir cache and return used object IDs for this out."""
- 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"