svthalia/concrexit

View on GitHub

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
Severity: Minor
Found in website/mailinglists/tests/test_gsuite.py - About 5 hrs to fix

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
Severity: Minor
Found in website/registrations/tests/test_forms.py - About 4 hrs to fix

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
Severity: Minor
Found in website/events/services.py - About 4 hrs to fix

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

Severity: Minor
Found in website/activemembers/models.py - About 4 hrs to fix

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
Severity: Minor
Found in website/registrations/tests/test_admin.py - About 4 hrs to fix

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
Severity: Minor
Found in website/sales/admin/order_admin.py - About 4 hrs to fix

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
Severity: Minor
Found in website/moneybirdsynchronization/models.py - About 4 hrs to fix

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
Severity: Minor
Found in website/registrations/admin.py - About 3 hrs to fix

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:
Severity: Minor
Found in website/events/services.py - About 3 hrs to fix

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
Severity: Minor
Found in website/events/admin/views.py - About 3 hrs to fix

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
Severity: Minor
Found in website/registrations/tests/test_emails.py - About 3 hrs to fix

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():
Severity: Minor
Found in website/thaliawebsite/templatetags/menu.py - About 3 hrs to fix

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 (
Severity: Minor
Found in website/registrations/models.py - About 3 hrs to fix

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
Severity: Minor
Found in website/members/models/profile.py - About 3 hrs to fix

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
Severity: Minor
Found in website/photos/tests/test_views.py - About 3 hrs to fix

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
Severity: Minor
Found in website/events/api/v2/views.py - About 3 hrs to fix

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');

Severity: Major
Found in website/events/static/events/js/listview.js - About 3 hrs to fix

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)
Severity: Minor
Found in website/photos/services.py - About 3 hrs to fix

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
Severity: Minor
Found in website/registrations/services.py - About 3 hrs to fix

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)
Severity: Minor
Found in website/registrations/views.py - About 2 hrs to fix

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

Severity
Category
Status
Source
Language