File utils.py
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import jsonschema
from typing import Any, Dict, Iterable, List, Set, Tuple
from cidc_schemas.constants import SCHEMA_DIR
Function descend_dict
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def descend_dict(root: dict, levels: List[str]) -> dict:
"""
Follows `levels` down through `root`
handles "items", "properties", and "url"s
- 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 load_subschema_from_url
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def load_subschema_from_url(definition: dict) -> dict:
"""
Handles urls in loading the subschema and default descriptions
Any non-artifact urls are replaced with their corresponding definition
Does NOT translate artifact urls, as they should be linked
- 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_merge_pointer_to_data_store
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def add_merge_pointer_to_data_store(
root: dict, merge_pointer: str, data_store: dict
) -> Set[str]:
"""
Updates data by nested-setting the endpoint of the pointer with the part of the schema it points to
- 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 flatten_allOf
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def flatten_allOf(schema: dict) -> dict:
"""
Combines `properties` and `required` inplace across all `allOf` if they exist
Parameters
- 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 nested_set
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def nested_set(