CIMAC-CIDC/cidc-schemas

View on GitHub
cidc_schemas/prism/pipelines.py

Summary

Maintainability
D
2 days
Test Coverage
A
99%

File pipelines.py has 685 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Analysis pipeline configuration generators."""
from collections import defaultdict
from datetime import datetime
from io import BytesIO
import logging
Severity: Major
Found in cidc_schemas/prism/pipelines.py - About 1 day to fix

    Function _pair_all_samples has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
    Open

        def _pair_all_samples(
            self, partic_map: Dict[str, Dict[str, Dict[str, str]]]
        ) -> List[_PairingEntry]:
            """
            (Semi)automated pairing of tumor and normal samples
    Severity: Minor
    Found in cidc_schemas/prism/pipelines.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 _generate_partic_map has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
    Open

        def _generate_partic_map(
            self,
            full_ct: dict,
        ) -> Dict[str, Dict[str, Dict[str, str]]]:
            """
    Severity: Minor
    Found in cidc_schemas/prism/pipelines.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

    Avoid deeply nested control flow statements.
    Open

                            if collection_event in normals.keys():
                                tumor_pair_list.append(
                                    _PairingEntry(
                                        tumor_cimac_id=sample,
                                        tumor_collection_event=collection_event,
    Severity: Major
    Found in cidc_schemas/prism/pipelines.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if other_cimac_id:
                                  cimac_id = self._choose_which_normal(
                                      full_ct, cimac_ids=[cimac_id, other_cimac_id]
                                  )
                              partic_map[cimac_participant_id]["normals"][
      Severity: Major
      Found in cidc_schemas/prism/pipelines.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status