Showing 227 of 702 total issues
File event.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Registers admin interfaces for the event model."""
from django.contrib import admin, messages
from django.template.defaultfilters import date as _date
from django.urls import path, reverse
- Create a ticketCreate a ticket
File models.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from secrets import token_urlsafe
from django.db import models
from django.db.models import Count, IntegerField, Value
- Create a ticketCreate a ticket
Function get_context_data
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs) -> dict:
context = super().get_context_data(**kwargs)
obj = context["course"]
courses = list(obj.old_courses.all())
courses.append(obj)
- 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 all_addresses
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def all_addresses(self):
"""Return all addresses subscribed to this mailing list."""
for member in self.members.all():
for email in get_member_email_addresses(member):
if email:
- 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 _member_group_memberships
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _member_group_memberships(
member: Member, condition: Callable[[Membership], bool]
) -> dict[str, dict[str, Any]]:
"""Determine the group membership of a user based on a condition.
- 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 from_env
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def from_env(
name, *, production=_NOT_SET, staging=_NOT_SET, testing=_NOT_SET, development=None
):
"""Generate a setting that's overridable by the process environment.
- 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 post
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request, **kwargs):
"""Submit encodings for a face encoding source.
Expects a json body as follows:
- 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 collect_usermenu
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def collect_usermenu():
sections = defaultdict(list)
for app in apps.get_app_configs():
if hasattr(app, "user_menu_items"):
- 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 complete_renewal
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def complete_renewal(renewal: Renewal):
"""Complete a renewal, prolonging a Membership or creating a new one."""
renewal.refresh_from_db()
if renewal.status != renewal.STATUS_ACCEPTED:
raise ValueError("Renewal is not accepted.")
- 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_mailing_lists
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def sync_mailing_lists(self, lists: list[GroupData] | None = None):
"""Sync mailing lists with GSuite. Lists are only deleted if all lists are synced and thus no lists are passed to this function.
:param lists: optional parameter to determine which lists to sync
"""
- 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
class Event(models.Model):
"""Describes an event."""
objects = QueryablePropertiesManager()
- Create a ticketCreate a ticket
Function extract_archive
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def extract_archive(album, archive) -> tuple[dict[str, str], int]:
"""Extract zip and tar files."""
warnings, count = {}, 0
if is_zipfile(archive):
archive.seek(0)
- 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_event_start_reminder
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def schedule_event_start_reminder(sender, instance, **kwargs):
"""Create, update or delete a scheduled start reminder for the event if necessary."""
message = getattr(instance, "start_reminder", None)
if not instance.published:
- 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_food_order_reminder_pushnotification
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def schedule_food_order_reminder_pushnotification(sender, instance, **kwargs):
"""Create, update or delete a scheduled message for the food event if necessary."""
message = getattr(instance, "end_reminder", None)
if not instance.send_notification:
- 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
File views.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Views provided by the registrations package."""
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required, permission_required
- Create a ticketCreate a ticket
Function update_registration
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update_registration(
member=None, event=None, name=None, registration=None, field_values=None, actor=None
):
"""Update a user registration of an 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 create_payment
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_payment(
model_payable: Model | Payable,
processed_by: Member,
pay_type: str,
) -> Payment | 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 create_or_update_external_invoice
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update_external_invoice(obj):
"""Create an external sales invoice on Moneybird for a payable object."""
if not settings.MONEYBIRD_SYNC_ENABLED:
return 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 schedule_registration_reminder
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def schedule_registration_reminder(sender, instance, **kwargs):
"""Create, update or delete a registration reminder for the event if necessary."""
message = getattr(instance, "registration_reminder", None)
if not instance.published or not instance.registration_required:
- 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 get_fields
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_fields(self):
fields = super().get_fields()
if self.information_fields:
for key, field in self.information_fields.items():
- 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"