src/make_queue/views/reservation.py
Function get_error_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_error_message(self, form, reservation):
"""
Generates the correct error message for the given form.
:param reservation: The reservation to generate an error message for
- 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 get_context_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_context_data(self, **kwargs):
"""
Creates the context data required for the make reservation template.
If reservation is given as a keyword argument, the view is made for that reservation.
- 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
Avoid too many return
statements within this function. Open
Open
return _("The reservation exceeds your quota")
Avoid too many return
statements within this function. Open
Open
return _("It is not possible to reserve the machine during these hours. Check the rules for when the machine is reservable")
Avoid too many return
statements within this function. Open
Open
return _("The reservation cannot start and end at the same time")
Avoid too many return
statements within this function. Open
Open
return _("The start time can't be after the end time")
Avoid too many return
statements within this function. Open
Open
return _("The reservation can't start in the past")
Avoid too many return
statements within this function. Open
Open
return _("The time slot is not available")
Error: invalid syntax (<unknown>, line 273)</unknown> Open
Open
match self.query_params['owner']:
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.
TODO found Open
Open
# TODO: rewrite this whole view (and everything that uses it), so that it's more extendable,
- Exclude checks