CIMAC-CIDC/cidc-schemas

View on GitHub

Showing 59 of 59 total issues

Function get_source has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
Open

def get_source(ct: dict, key: str, skip_last=None) -> (JSON, JSON):
    """
    extract the object in the dictionary specified by
    the supplied key (or one of its parents.)

Severity: Minor
Found in cidc_schemas/util.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 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 downgrade has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
Open

    def downgrade(cls, metadata: dict, *args, **kwargs) -> MigrationResult:
        if "cytof" in metadata.get("assays", {}):
            for batch in metadata["assays"]["cytof"]:
                for record in batch["records"]:
                    if "concatenation_version" in record["input_files"]:
Severity: Minor
Found in cidc_schemas/migrations.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 upgrade has a Cognitive Complexity of 23 (exceeds 10 allowed). Consider refactoring.
Open

    def upgrade(cls, metadata: dict, *args, **kwargs) -> MigrationResult:

        not_reported = _encrypt("Not reported")

        for p in metadata.get("participants", []):
Severity: Minor
Found in cidc_schemas/migrations.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 descend_dict has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
Open

def descend_dict(root: dict, levels: List[str]) -> dict:
    """
    Follows `levels` down through `root`
        handles "items", "properties", and "url"s

Severity: Minor
Found in docs/utils.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_subschema_from_url has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring.
Open

def load_subschema_from_url(definition: dict) -> dict:
    """
    Handles urls in loading the subschema and default descriptions
    Any non-artifact urls are replaced with their corresponding definition
    Does NOT translate artifact urls, as they should be linked
Severity: Minor
Found in docs/utils.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 _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

Function _get_values_for_path_pattern has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

    def _get_values_for_path_pattern(self, path: str, doc: dict) -> set:
        """
        Search `doc` for every value matching `path`, and return those values as a set.

        Path can contain wildcards (e.g., `/my/path/*/with/wildcard/*/hooray`) but partial
Severity: Minor
Found in cidc_schemas/json_validation.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_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 merge_artifact has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def merge_artifact(
Severity: Major
Found in cidc_schemas/prism/merger.py - About 1 hr to fix

    Function _write_data_dict has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
    Open

        def _write_data_dict(self, schemas):
            """
            Adds a "Data Dictionary" tab that lists all used enums with allowed values.
    
            Returns: a dict mapping field names to data dictionary sheet ranges of enum
    Severity: Minor
    Found in cidc_schemas/template_writer.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 add_merge_pointer_to_data_store has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
    Open

    def add_merge_pointer_to_data_store(
        root: dict, merge_pointer: str, data_store: dict
    ) -> Set[str]:
        """
        Updates data by nested-setting the endpoint of the pointer with the part of the schema it points to
    Severity: Minor
    Found in docs/utils.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 _calc_merge_pointer has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
    Open

    def _calc_merge_pointer(file_path: str, context: dict, key: str):
        """Return the merge_pointer in context that the file_path directs to
    
        Params
        ------
    Severity: Minor
    Found in cidc_schemas/template.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 flatten_allOf has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
    Open

    def flatten_allOf(schema: dict) -> dict:
        """
        Combines `properties` and `required` inplace across all `allOf` if they exist
    
        Parameters
    Severity: Minor
    Found in docs/utils.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 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 _build_artifact has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def _build_artifact(
    Severity: Major
    Found in cidc_schemas/unprism.py - About 50 mins to fix

      Function merge has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def merge(self, walk, base, head, schema, meta, idRef="id", **kwargs):
      Severity: Major
      Found in cidc_schemas/prism/merger.py - About 50 mins to fix

        Function merge has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def merge(self, walk, base, head, schema, meta, **kwargs):
        Severity: Minor
        Found in cidc_schemas/prism/merger.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if cell.value == "" or not cell.value:
                                      continue
          
                                  # get the identifier
                                  # check that it is a CIMAC PART ID
          Severity: Major
          Found in cidc_schemas/prism/extra_metadata.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if cimac_partid_regex.match(str(cell.value)):
                                        ids.add(cell.value)
            
            
            Severity: Major
            Found in cidc_schemas/prism/extra_metadata.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language