Showing 601 of 702 total issues
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
Function get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, *args, **kwargs):
"""Mark a user as present.
Checks if the url is correct, the event has not ended yet, and the user is registered.
"""
- 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_event_start_reminder_users_on_registration_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_event_start_reminder_users_on_registration_save(sender, instance, **kwargs):
"""Add or remove the member from the event start reminder."""
message = getattr(instance.event, "start_reminder", None)
if message is None or message.sent:
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
try:
if self.until and (not self.since or self.until < self.since):
raise ValidationError(
{"until": _("End date can't be before start date")}
- 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 pre_member_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pre_member_save(instance, **kwargs):
if not settings.GSUITE_MEMBERS_AUTOSYNC:
return
existing_member = Member.objects.filter(pk=instance.pk).first()
- 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 __call__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, request, *args, **kwargs):
event = None
if "pk" in kwargs:
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 create_or_update_contact
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update_contact(member: Member):
"""Push a Django user/member to Moneybird."""
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 get_used_media
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_used_media(storage):
"""Get the filenames of all files stored in a FileField of any model."""
media = set()
for field in get_file_fields():
- 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 handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
verbosity = options.get("verbosity")
private_storage = DefaultStorage()
unused_private_media = get_unused_media(
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, field, request, params, model, model_admin, field_path):
- Create a ticketCreate a ticket
Function formfield_for_foreignkey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Customise the formfields of event and member."""
if db_field.name == "event":
# allow to restrict event
if request.GET.get("event_pk"):
- 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 execute_data_minimisation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute_data_minimisation(dry_run=False, members=None) -> list[Member]:
"""Clean the profiles of members/users of whom the last membership ended at least 31 days ago.
:param dry_run: does not really remove data if True
:param members: queryset of members to process, optional
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
if self.amount == 0:
raise ValidationError({"amount": f"Payments cannot be €{self.amount}"})
if self.type != Payment.TPAY and self.batch is not None:
raise ValidationError(
- 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
Avoid deeply nested control flow statements. Open
if category["name"] not in categories:
categories[category["name"]] = {"items": [], **category}
- Create a ticketCreate a ticket
Function get_context
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_context(self, name, value, attrs) -> dict:
context = super().get_context(name, value, attrs)
if self.obj:
# Make sure to ALWAYS use committed data from the database, and never invalid data that is not saved, for example from an invalid form
self.obj.refresh_from_db()
- 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
Avoid deeply nested control flow statements. Open
if section["name"] not in sections:
sections[section["name"]] = {"items": [], **section}
- Create a ticketCreate a ticket
Function setting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setting(*, development, production, staging=_NOT_SET, testing=_NOT_SET):
"""Generate a setting depending on the DJANGO_ENV and the arguments.
This function is meant for static settings that depend on the DJANGO_ENV. If the
staging or testing arguments are left to their defaults, they will fall back to
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
super().clean()
errors = {}
if not self.is_minimized and not (
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_env(
- Create a ticketCreate a ticket