CIMAC-CIDC/cidc-schemas

View on GitHub
cidc_schemas/prism/core.py

Summary

Maintainability
D
1 day
Test Coverage
A
99%

File core.py has 403 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Build metadata dictionaries from Excel files."""
import logging
import base64
import hmac
from typing import List, Tuple, Union
Severity: Minor
Found in cidc_schemas/prism/core.py - About 5 hrs to fix

    Function prismify has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring.
    Open

    def prismify(
        xlsx: XlTemplateReader,
        template: Template,
        schema_root: str = SCHEMA_DIR,
        debug: bool = False,
    Severity: Minor
    Found in cidc_schemas/prism/core.py - About 4 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 _set_val has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

    def _set_val(
        pointer: str,
        val: object,
        context: dict,
        root: Union[dict, None] = None,
    Severity: Minor
    Found in cidc_schemas/prism/core.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 _set_val has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _set_val(
    Severity: Minor
    Found in cidc_schemas/prism/core.py - About 35 mins to fix

      Function __jpointer_insert_next_thing has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

      def __jpointer_insert_next_thing(doc, jpoint, part, next_thing):
          """
          Puts next_thing into a doc (that is being `jsonpointer.walk`ed)
          by *part* "address". *jpoint* is Jsonpointer that is walked.
          """
      Severity: Minor
      Found in cidc_schemas/prism/core.py - About 25 mins 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