Showing 230 of 705 total issues
File test_gsuite.py
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Test for the GSuite sync in the mailinglists package."""
from unittest import mock
from unittest.mock import MagicMock
from django.conf import settings
- Create a ticketCreate a ticket
File test_forms.py
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.conf import settings
from django.test import TestCase, override_settings
from django.utils import timezone
from freezegun import freeze_time
- Create a ticketCreate a ticket
Function event_permissions
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def event_permissions(member, event: Event, name=None, registration_prefetch=False):
"""Return a dictionary with the available event permissions of the user.
:param member: the user
:param event: 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
File models.py
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""The models defined by the activemembers package."""
import datetime
import logging
- Create a ticketCreate a ticket
File test_admin.py
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
from unittest import mock
from django.contrib.admin import AdminSite
from django.contrib.auth.models import Permission
from django.http import HttpRequest
- Create a ticketCreate a ticket
File order_admin.py
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
from functools import partial
from django.contrib import admin, messages
from django.contrib.admin import SimpleListFilter, register
from django.forms import Field
- Create a ticketCreate a ticket
File models.py
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
- Create a ticketCreate a ticket
File admin.py
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Registers admin interfaces for the registrations module."""
from functools import partial
from django.contrib import admin
from django.forms import Field
- Create a ticketCreate a ticket
Function registration_status
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def registration_status(event: Event, registration: EventRegistration, member):
if not event.registration_required and not event.optional_registration_allowed:
return status.STATUS_NONE
if not member or not member.is_authenticated:
- 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
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, pk):
"""Export the registration of a specified event.
: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
File test_emails.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
import uuid
from unittest import mock
from django.conf import settings
from django.core import mail
- Create a ticketCreate a ticket
Function collect_menus
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def collect_menus():
categories = defaultdict(list)
main_menu = []
for app in apps.get_app_configs():
- 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 24 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
super().clean()
errors = {}
if (
- 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 profile.py
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
- Create a ticketCreate a ticket
File test_views.py
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
from datetime import date
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
- Create a ticketCreate a ticket
File views.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.db.models import Prefetch, Q
from django.utils import timezone
from oauth2_provider.contrib.rest_framework import IsAuthenticatedOrTokenHasScope
from rest_framework import filters as framework_filters
- Create a ticketCreate a ticket
Function renderEvents
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderEvents(eventStore, eventUiHash) {
const skeleton = document.createElement('div');
skeleton.id = 'fc-listview';
skeleton.classList.add('accordion', 'bordered');
- Create a ticketCreate a ticket
Function extract_archive
has a Cognitive Complexity of 22 (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
File services.py
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""The services defined by the registrations package."""
import secrets
from django.contrib.admin.models import CHANGE, LogEntry
- Create a ticketCreate a ticket
Function post
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request, *args, **kwargs):
action = request.POST.get("action")
entry = get_object_or_404(Entry, pk=kwargs["pk"])
registration = getattr(entry, "registration", 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"