CIMAC-CIDC/cidc-api-gae

View on GitHub
cidc_api/resources/upload_jobs.py

Summary

Maintainability
A
2 hrs
Test Coverage
B
86%

Function _remove_optional_uuid_recursive has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
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
Severity: Minor
Found in cidc_api/resources/upload_jobs.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 inner has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
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)
Severity: Minor
Found in cidc_api/resources/upload_jobs.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

There are no issues that match your filters.

Category
Status