CIMAC-CIDC/cidc-schemas

View on GitHub
cidc_schemas/template_reader.py

Summary

Maintainability
C
1 day
Test Coverage
A
98%

Function _validate_worksheet has a Cognitive Complexity of 54 (exceeds 10 allowed). Consider refactoring.
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.
Severity: Minor
Found in cidc_schemas/template_reader.py - About 7 hrs 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 from_excel has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

    def from_excel(xlsx_path: Union[str, BinaryIO]):
        """
        Initialize an Excel template reader from an excel file.

        Arguments:
Severity: Minor
Found in cidc_schemas/template_reader.py - About 2 hrs 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 _make_validation_error has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _make_validation_error(
Severity: Minor
Found in cidc_schemas/template_reader.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status