Showing 227 of 702 total issues
Function test_create_registration
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_create_registration(self, perms_mock):
self.event.registration_start = timezone.now() - timedelta(hours=2)
self.event.registration_end = timezone.now() + timedelta(hours=1)
perms_mock.return_value = {
- Create a ticketCreate a ticket
Function send_email
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_email(
- Create a ticketCreate a ticket
Function grid_item
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def grid_item(
- Create a ticketCreate a ticket
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
- Create a ticketCreate a ticket
Function validate_unique
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_unique(self, **kwargs):
try:
super().validate_unique(**kwargs)
# Skip checks if group hasn't been saved yet.
if self.group.id is not None:
- 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
Function maintain_integrity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def maintain_integrity(func):
def wrapper(*args, **kwargs):
try_amnt = 0
while True:
try:
- 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
Function _sync_contacts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _sync_contacts():
logger.info("Synchronizing contacts...")
# Make moneybird contacts for people that dont have.
for member in Member.objects.filter(
moneybird_contact__isnull=True, profile__is_minimized=False
- 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
Function update_registration_by_organiser
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_registration_by_organiser(registration, member, data):
if not is_organiser(member, registration.event):
raise RegistrationError(_("You are not allowed to update this registration."))
if "present" in 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"
Further reading
Function clean
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
errors = {}
if (self.member is None and not self.name) or (self.member and self.name):
errors.update(
{
- 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
Function registrations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def registrations(self, request, pk):
"""Define a custom route for the event's registrations, can filter on registration status if the user is an organiser.
:param request: the request object
:param pk: the primary key of the event
- 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
Function clean_changes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. 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"
Further reading
Function schedule_new_album_pushnotification
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def schedule_new_album_pushnotification(sender, instance, **kwargs):
"""Create, update or delete a scheduled message for the saved album if necessary."""
message = getattr(instance, "new_album_notification", None)
if instance.hidden or instance.is_processing:
- 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
Function cancel_order
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cancel_order(request):
"""View that cancels a user's order."""
if "order" in request.POST:
try:
order = get_object_or_404(FoodOrder, pk=int(request.POST["order"]))
- 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
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, *args, require_address=False, **kwargs):
super().__init__(*args, **kwargs)
user = Member.objects.get(pk=kwargs["instance"].user_id)
for field in [
"birthday",
- 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
Function save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save(
self, force_insert=False, force_update=False, using=None, update_fields=None
):
if self.shift.locked and (
self._total_amount != 0 or (self._total_amount == 0 and not self._is_free)
- 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
Function display_name
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def display_name(self):
pref = self.display_name_preference
if pref == "nickname" and self.nickname is not None:
return f"'{self.nickname}'"
if pref == "firstname":
- 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
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if warning := _try_save_photo(album, file, photo):
warnings[photo] = warning
else:
count += 1
return warnings, count
- Create a ticketCreate a ticket
Function update_registration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_registration(
- Create a ticketCreate a ticket
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
- Create a ticketCreate a ticket