Function schematics_field_to_schema
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def schematics_field_to_schema(field: BaseType, generate_required=True):
base = TYPES_TO_JSON_SCHEMA.get(type(field))
if base:
base = deepcopy(base)
- 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 _json_try_convert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _json_try_convert(value, err, no_throw=False):
if isinstance(value, (bytes, str)):
try:
return json.loads(value)
except json.JSONDecodeError:
- 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 to_native
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_native(self, value, context=None):
if isinstance(value, (memoryview, bytes)):
return value
if isinstance(value, 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"