File __init__.py
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
"""Helpers for other modules."""
import hashlib
import json
import logging
Function parse_target
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def parse_target(
target: str, default: Optional[str] = None, isa_glob: bool = False
) -> Tuple[Optional[str], Optional[str]]:
from dvc.dvcfile import LOCK_FILE, PROJECT_FILE, is_valid_filename
from dvc.exceptions import DvcException
- 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 fix_env
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Wontfix
def fix_env(env=None):
"""Fix env variables modified by PyInstaller [1] and pyenv [2].
[1] http://pyinstaller.readthedocs.io/en/stable/runtime-information.html
[2] https://github.com/pyenv/pyenv/issues/985
"""
- 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 resolve_paths
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve_paths(repo, out, always_local=False):
from urllib.parse import urlparse
from dvc.dvcfile import DVC_FILE_SUFFIX
from dvc.exceptions import DvcException
- 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 error_handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def error_handler(func):
def wrapper(*args, **kwargs):
onerror = kwargs.get("onerror", None)
result = {}
- 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
Avoid too many return
statements within this function. Open
return path or default, name