File base.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
from inspect import signature
from typing import Any, Callable, List, TypeVar, Union
import fhir.resources
import httpx
Function __repr__
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def __repr__(self):
resource = self.resource.resource_type
if self.query_parameters.include_parameters:
includes = []
rev_includes = []
- 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 include
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def include(
self: T,
resource: str = None,
reference_param: str = None,
target: str = None,
- 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
Consider simplifying this complex logical expression. Open
if include_dict and include_param:
raise ValueError("Cannot use both include_dict and include_param")
elif include_dict and (resource or reference_param or target):
raise ValueError("Cannot use both include_dict and kv parameters")
elif include_param and (resource or reference_param or target):
Function where
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def where(
self: T,
field: str = None,
operator: Union[QueryOperators, str] = None,
value: Union[int, float, bool, str, list] = None,
- 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 has
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def has(
self: T,
resource: str = None,
reference_param: str = None,
search_param: str = None,
- 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 __init__
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
base_url: str,
resource: Union[
FHIRResourceModel, fhir.resources.FHIRAbstractModel, str
- 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 _make_query_string
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _make_query_string(self) -> str:
"""
Make the query string from the query parameters
Returns:
- 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 has
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def has(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function include
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def include(
Consider simplifying this complex logical expression. Open
if has_param and (
resource or reference_param or search_param or operator or value
):
raise ValueError("Cannot use both has_param and kv parameters")
Consider simplifying this complex logical expression. Open
if not has_param and not (
resource or reference_param or search_param or operator or value
):
raise ValueError(
"Must provide either has_param or a valid set of kv parameters"
Function _param_from_field
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _param_from_field(field, operator, value):
if not (operator or operator == "") and value:
kv_error_message = (
f"\n\tField: {field}\n\tOperator: {operator}\n\tValue: {value}"
)
- 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"