svthalia/concrexit

View on GitHub

Showing 227 of 702 total issues

Function _do_next has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _do_next(request, response):
    """See DoNextModelAdmin."""
    if "next" in request.GET:
        if not url_has_allowed_host_and_scheme(
            request.GET["next"], allowed_hosts={request.get_host()}
Severity: Minor
Found in website/utils/admin.py - About 35 mins 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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def index(request):
    """Overview of user order for a pizza event."""
    products = Product.available_products.order_by("name")
    if not request.user.has_perm("pizzas.order_restricted_products"):
        products = products.exclude(restricted=True)
Severity: Minor
Found in website/pizzas/views.py - About 35 mins 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 delete_contact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def delete_contact(contact: MoneybirdContact):
    """Delete or archive a contact on Moneybird, and delete our record of it."""
    if not settings.MONEYBIRD_SYNC_ENABLED:
        return

Severity: Minor
Found in website/moneybirdsynchronization/services.py - About 35 mins 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 _sync_outdated_invoices has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _sync_outdated_invoices():
    """Resynchronize all invoices that have been marked as outdated."""
    invoices = MoneybirdExternalInvoice.objects.filter(
        needs_synchronization=True, needs_deletion=False
    ).order_by("payable_model", "object_id")
Severity: Minor
Found in website/moneybirdsynchronization/services.py - About 35 mins 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 membergroup_member_card has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def membergroup_member_card(membership):
    meta_text = ""

    if "role" in membership and membership["role"]:
        meta_text += f"<p class=\"px-1\">{membership['role']}</p>"
Severity: Minor
Found in website/activemembers/templatetags/activemembers_cards.py - About 35 mins 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 create_group has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create_group(self, group):
        """Create a new group based on the provided data.

        :param group: GroupData to create a group for
        """
Severity: Minor
Found in website/mailinglists/gsuite.py - About 35 mins 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_thumbnail_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_thumbnail_url(
    file,
    size: str,
    absolute_url: bool = False,
    expire_seconds: int | None = None,
Severity: Minor
Found in website/utils/media/services.py - About 35 mins 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 is_eventdocument_owner has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def is_eventdocument_owner(member, event_doc):
    if member and member.is_authenticated:
        if member.is_superuser or member.has_perm("documents.override_owner"):
            return True

Severity: Minor
Found in website/events/services.py - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        super().clean()
        errors = {}

        if (
Severity: Minor
Found in website/registrations/models.py - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, *args, **kwargs):
        order = get_object_or_404(Order, pk=kwargs["pk"])
        if order.payment:
            messages.warning(request, _("This order was already paid for."))
            return redirect("index")
Severity: Minor
Found in website/sales/views.py - About 35 mins 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 member_achievements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def member_achievements(member) -> list:
    """Derive a list of achievements of a member.

    Committee and board memberships + mentorships
    """
Severity: Minor
Found in website/members/services.py - About 35 mins 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 formfield_for_foreignkey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
        """Limit product list items to items of order's shift."""
        field = super().formfield_for_foreignkey(db_field, request, **kwargs)

        if db_field.name == "product":
Severity: Minor
Found in website/sales/admin/order_admin.py - About 35 mins 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 admin_unauthorized_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def admin_unauthorized_view(request):
    if not request.member:
        url = "/user/account/login"
        args = request.META.get("QUERY_STRING", "")
        if args:
Severity: Minor
Found in website/thaliawebsite/views.py - About 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def update(self, instance, validated_data, **kwargs):
        """Override the default implementation of DRF's ModelSerializer.

        Adds `instance.clean()` to make sure all updates still clean().
        Also re-raises ValidationErrors to DRF ValidationErrors.
Severity: Minor
Found in website/thaliawebsite/api/v2/serializers/cleaned_model_serializer.py - About 35 mins 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 send_information_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def send_information_request(dry_run=False):
    """Send an email to all members to have them check their personal information.

    :param dry_run: does not really send emails if True
    """
Severity: Minor
Found in website/members/emails.py - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        super().clean()

        errors = {}
        if self.until and (not self.since or self.until < self.since):
Severity: Minor
Found in website/members/models/membership.py - About 35 mins 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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, commit=True):
        instance = super().save(commit)
        if commit:
            if self.cleaned_data["receive_thabloid"]:
                ThabloidUser.objects.get(pk=instance.user.pk).allow_thabloid()
Severity: Minor
Found in website/members/forms.py - About 35 mins 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 export_csv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def export_csv(self, request: HttpRequest, queryset: QuerySet) -> HttpResponse:
        """Export a CSV of payments.

        :param request: Request
        :param queryset: Items to be exported
Severity: Minor
Found in website/payments/admin.py - About 35 mins 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

Avoid too many return statements within this function.
Open

                return status.STATUS_CANCELLED
Severity: Major
Found in website/events/services.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return status.STATUS_OPEN
Severity: Major
Found in website/events/services.py - About 30 mins to fix
Severity
Category
Status
Source
Language