justaddcoffee/kg-emerging-viruses

View on GitHub
kg_covid_19/transform_utils/intact/intact.py

Summary

Maintainability
C
1 day
Test Coverage
C
74%

File intact.py has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Transform IntAct PPI data."""

import fnmatch
import logging
import os
Severity: Minor
Found in kg_covid_19/transform_utils/intact/intact.py - About 3 hrs to fix

    Function parse_experiment_info has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_experiment_info(self, xmldoc: minidom.Document) -> Dict[int, str]:
            """Extract info about experiment from miXML doc.
    
            :param self: IntAct instance
            :param xmldoc: a minidom object containing a miXML doc
    Severity: Minor
    Found in kg_covid_19/transform_utils/intact/intact.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 interaction_to_edge has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def interaction_to_edge(
            self, interaction: minidom.Element, nodes_dict: dict, exp_dict: dict
        ) -> list:
            """Parse an interaction to an edge."""
            edges: List[list] = []
    Severity: Minor
    Found in kg_covid_19/transform_utils/intact/intact.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 interactor_to_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def interactor_to_node(self, interactor: minidom.Element) -> List[Union[int, list]]:
            """Parse an interactor as a list of nodes."""
            interactor_id = interactor.attributes["id"].value
    
            this_id = ""
    Severity: Minor
    Found in kg_covid_19/transform_utils/intact/intact.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self, data_file: Optional[str] = None):
            """Run transform to ingest data from IntAct for viral/human PPIs."""
            data_files = list()
            if not data_file:
                data_files.append(
    Severity: Minor
    Found in kg_covid_19/transform_utils/intact/intact.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

    There are no issues that match your filters.

    Category
    Status