cidc_api/resources/upload_jobs.py
Function _remove_optional_uuid_recursive
has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring. Open
Open
def _remove_optional_uuid_recursive(target: dict, uuid: str):
"""
If target contains an item : dict with {"upload_placeholder":uuid}, removes that item and returns the modified target
If no such item is found, continues recursively as depth first search
If the uuid is never found, returns the target unchanged
- 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 inner
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
Open
def inner(f):
@wraps(f)
def wrapped(*args, **kwargs):
logger.info(f"upload_handler({f.__name__}) started")
template, xlsx_file = extract_schema_and_xlsx(allowed_types)
- 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"