CIMAC-CIDC/cidc-schemas

View on GitHub
docs/generate_docs.py

Summary

Maintainability
D
2 days
Test Coverage

File generate_docs.py has 702 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
from collections import OrderedDict
from copy import deepcopy
import jinja2
import json
Severity: Major
Found in docs/generate_docs.py - About 1 day to fix

    Function _update_definition_from_merge_pointer has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring.
    Open

        def _update_definition_from_merge_pointer(
            self,
            context_pointer: str,
            definition: dict,
        ) -> dict:
    Severity: Minor
    Found in docs/generate_docs.py - About 3 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 _load_available_assays_and_analyses has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
    Open

    def _load_available_assays_and_analyses() -> Dict[str, Dict[str, dict]]:
        ret = dict()
    
        components_dir: str = os.path.join(SCHEMA_DIR, "assays", "components")
        ret["available_assays"] = utils.load_schema(components_dir, "available_assays.json")
    Severity: Minor
    Found in docs/generate_docs.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 load_assay_schemas has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
    Open

    def load_assay_schemas() -> Dict[str, AssaySchema]:
        """
        Load all assay template JSON schemas into a dictionary
        and values are AssaySchema with the related template schemas and assay description.
        """
    Severity: Minor
    Found in docs/generate_docs.py - About 55 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

    Function _make_file has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _make_file(
    Severity: Minor
    Found in docs/generate_docs.py - About 35 mins to fix

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

      def generate_docs(out_directory: str = HTML_DIR):
          """
          Generate documentation based on the schemas found in `SCHEMA_DIR`.
          """
      
      
      Severity: Minor
      Found in docs/generate_docs.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