Function toDict
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def toDict(self):
retval = dict()
if isinstance(self, Resource):
retval['resourceType'] = self.__class__.__name__
- 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 _fromDict
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def _fromDict(self, object_dict):
for attr, obj in object_dict.items():
prop, prop_type = self._get_property_details_for_name(attr)
value = 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
File __init__.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import json
import sys
import math
Function __set__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __set__(self, instance, value):
if self.definition.count_max > 1:
if isinstance(value, list):
instance._values.setdefault(self.definition.name, PropertyList(self.definition))
del instance._values[self.definition.name][:]
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, property_type, count_max=1, count_min=0, required=False):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, property_type, count_max=1, count_min=0, required=False):
Function validate_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_type(self, value):
if value is not None:
local_type = self.eval_property_type()
if local_type is FHIRDate and not FHIRDate.validate_type(value):
raise ValueError(gettext('Value "{}" is not a valid value of FHIRDate').format(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"