svthalia/concrexit

View on GitHub

Showing 227 of 702 total issues

File settings.py has 983 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Django settings for concrexit.

For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/

Severity: Major
Found in website/thaliawebsite/settings.py - About 2 days to fix

Function handle has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **options):
        username = options[self.UserModel.USERNAME_FIELD]
        database = options["database"]
        user_data = {}
        verbose_field_name = self.username_field.verbose_name
Severity: Minor
Found in website/members/management/commands/createmember.py - About 1 day 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 admin.py has 643 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Registers admin interfaces for the payments module."""
import csv
from collections import OrderedDict

from django.contrib import admin, messages
Severity: Major
Found in website/payments/admin.py - About 1 day to fix

File test_admin_views.py has 621 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from unittest import mock
from unittest.mock import MagicMock, Mock, PropertyMock, patch

from django.apps import apps
from django.contrib.admin.utils import model_ngettext
Severity: Major
Found in website/payments/tests/test_admin_views.py - About 1 day to fix

File test_views.py has 615 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from unittest import mock
from unittest.mock import ANY, MagicMock, Mock, PropertyMock, patch

from django.apps import apps
from django.contrib.auth import get_user_model
Severity: Major
Found in website/payments/tests/test_views.py - About 1 day to fix

File test_admin.py has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.contrib.admin import AdminSite
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.test import Client, RequestFactory, TestCase
from django.urls import reverse
Severity: Major
Found in website/sales/tests/test_admin.py - About 1 day to fix

File test_views.py has 527 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime

from django.conf import settings
from django.contrib.auth.models import Permission
from django.core import mail
Severity: Major
Found in website/events/tests/test_views.py - About 1 day to fix

File test_services.py has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.core import mail
from django.test import TestCase, override_settings
from django.utils import timezone

from freezegun import freeze_time
Severity: Major
Found in website/registrations/tests/test_services.py - About 1 day to fix

Function clean has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        super().clean()
        errors = {}
        if self.start is None:
            errors.update({"start": _("Start cannot have an empty date or time field")})
Severity: Minor
Found in website/events/models/event.py - About 7 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_api.py has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime

from django.test import TestCase, override_settings
from django.urls import reverse
from django.utils import timezone
Severity: Minor
Found in website/events/tests/test_api.py - About 7 hrs to fix

File test_services.py has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from random import randint
from unittest import mock

from django.test import TestCase, override_settings
from django.utils import timezone
Severity: Minor
Found in website/moneybirdsynchronization/tests/test_services.py - About 7 hrs to fix

File test_models.py has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime
from decimal import Decimal
from unittest.mock import PropertyMock, patch

from django.core.exceptions import ValidationError
Severity: Minor
Found in website/payments/tests/test_models.py - About 7 hrs to fix

File services.py has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging

from django.conf import settings
from django.contrib.admin.utils import model_ngettext
from django.contrib.contenttypes.models import ContentType
Severity: Minor
Found in website/moneybirdsynchronization/services.py - About 7 hrs to fix

File models.py has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""The models defined by the registrations package."""
import string
import unicodedata
import uuid

Severity: Minor
Found in website/registrations/models.py - About 7 hrs to fix

File services.py has 447 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import OrderedDict
from datetime import date, timedelta

from django.db.models import Q
from django.utils import timezone
Severity: Minor
Found in website/events/services.py - About 6 hrs to fix

File test_services.py has 432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from datetime import datetime, timedelta
from unittest import mock

from django.contrib.auth.models import AnonymousUser, Permission
from django.http import HttpRequest
Severity: Minor
Found in website/events/tests/test_services.py - About 6 hrs to fix

File test_models.py has 422 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.test import TestCase, override_settings
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
Severity: Minor
Found in website/registrations/tests/test_models.py - About 6 hrs to fix

File test_models.py has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from unittest.mock import MagicMock

from django.core.exceptions import ValidationError
from django.test import TestCase
from django.utils import timezone
Severity: Minor
Found in website/sales/tests/test_models.py - About 5 hrs to fix

File gsuite.py has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""GSuite syncing helpers defined by the mailinglists package."""
import logging
from random import random
from time import sleep

Severity: Minor
Found in website/mailinglists/gsuite.py - About 5 hrs to fix

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
Severity
Category
Status
Source
Language