File fhir_server.py
has 862 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import re
from typing import Iterable, List, Union
import fhir.resources
FhirServer
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class FhirServer:
def __init__(
self,
api_address: str,
username: Union[str, None] = None,
Function __init__
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function transfer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def transfer(
Function from_env
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def from_env(cls, no_auth: bool = False) -> "FhirServer":
api_address = _api_address_from_env()
server_type = os.getenv("FHIR_SERVER_TYPE")
if no_auth:
- Read upRead up
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_all
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_all(
self,
resources: List[Union[Resource, FHIRAbstractModel, dict]],
batch_size: int = 1000,
display: bool = True,
- Read upRead up
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 _setup_transport
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _setup_transport(
self, async_transport: bool = False
) -> Union[RetryTransport, httpx.AsyncHTTPTransport, httpx.HTTPTransport]:
"""Setup the transport for the httpx client if retryable methods or status codes are set
for the server the requests will be retried according to the configuration
- Read upRead up
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"