cidc_schemas/template_reader.py
Function _validate_worksheet
has a Cognitive Complexity of 54 (exceeds 10 allowed). Consider refactoring. Open
Open
def _validate_worksheet(self, worksheet_name: str, ws_schema: dict) -> List[str]:
"""Validate rows in a worksheet, returning a list of validation error messages."""
self.visited_fields.clear()
# If no worksheet is found, return only that error.
- 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 from_excel
has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring. Open
Open
def from_excel(xlsx_path: Union[str, BinaryIO]):
"""
Initialize an Excel template reader from an excel file.
Arguments:
- 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 _make_validation_error
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _make_validation_error(