Function save_and_audit_temporary_export_details
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def save_and_audit_temporary_export_details(request, application, serializer):
new_temp_export_details = get_new_field_values(serializer.validated_data, TEMP_EXPORT_DETAILS_FIELDS)
if new_temp_export_details:
old_temp_export_details = get_old_field_values(application, TEMP_EXPORT_DETAILS_FIELDS)
serializer.save()
- 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 save_and_audit_have_you_been_informed_ref
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save_and_audit_have_you_been_informed_ref(request, application, serializer):
old_have_you_been_informed = application.have_you_been_informed
have_you_been_informed = request.data.get("have_you_been_informed")
if have_you_been_informed:
- 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 _transform_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _transform_values(old_end_use_value, new_end_use_value):
if isinstance(old_end_use_value, bool):
old_end_use_value = "Yes" if old_end_use_value else "No"
if isinstance(new_end_use_value, bool):
- 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"