migraf/fhir-kindling

View on GitHub
fhir_kindling/fhir_server/transfer.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function _resource_from_graph_node has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _resource_from_graph_node(graph: nx.DiGraph, node: str) -> FHIRAbstractModel:
    """
    Get a resource from a graph node.

    Args:
Severity: Minor
Found in fhir_kindling/fhir_server/transfer.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 _update_successors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _update_successors(graph: nx.DiGraph, node: str, reference: str):
    """
    Update the successors of a node in a graph with the updated reference from the new server.

    Args:
Severity: Minor
Found in fhir_kindling/fhir_server/transfer.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 resolve_reference_graph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def resolve_reference_graph(
    graph: nx.DiGraph,
    target: "FhirServer",
    record_linkage: bool,
    display: bool,
Severity: Minor
Found in fhir_kindling/fhir_server/transfer.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 reference_graph has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def reference_graph(resources: List[Union[Resource, FHIRAbstractModel]]) -> nx.DiGraph:
    """
    Creates a graph of the references in a list of resources.

    Args:
Severity: Minor
Found in fhir_kindling/fhir_server/transfer.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 transfer has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def transfer(
Severity: Major
Found in fhir_kindling/fhir_server/transfer.py - About 50 mins to fix

    Function _get_transfer_resources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_transfer_resources(
        source: "FhirServer",
        resources: List[Union[Resource, FHIRAbstractModel]] = None,
        query: FhirQuerySync = None,
        get_missing: bool = True,
    Severity: Minor
    Found in fhir_kindling/fhir_server/transfer.py - About 45 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