website/events/models/event.py
File event.py
has 624 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
import uuid
from django.conf import settings
from django.core import validators
from django.core.exceptions import ObjectDoesNotExist, ValidationError
- Create a ticketCreate a ticket
Function clean
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
Open
def clean(self):
super().clean()
errors = {}
if self.start is None:
errors.update({"start": _("Start cannot have an empty date or time field")})
- Read upRead up
- Create a ticketCreate a ticket
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
Event
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Event(models.Model):
"""Describes an event."""
objects = QueryablePropertiesManager()
- Create a ticketCreate a ticket
Function clean_changes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def clean_changes(self, changed_data):
"""Check if changes from `changed_data` are allowed.
This method should be run from a form clean() method, where changed_data
can be retrieved from self.changed_data
- Read upRead up
- Create a ticketCreate a ticket
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"