svthalia/concrexit

View on GitHub

Showing 227 of 702 total issues

Function post has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request, *args, app_label, model_name, payable, **kwargs):
        if "type" not in request.POST:
            raise SuspiciousOperation("Missing POST parameters")

        if "next" in request.POST and not url_has_allowed_host_and_scheme(
Severity: Minor
Found in website/payments/admin_views.py - About 45 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 post has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def post(self, request, *args, app_label, model_name, payable, **kwargs):
Severity: Minor
Found in website/payments/admin_views.py - About 45 mins to fix

Function registration_fields has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def registration_fields(request, member=None, event=None, registration=None, name=None):
Severity: Minor
Found in website/events/services.py - About 35 mins to fix

Function request has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function request(method, url, data, success, error) {
Severity: Minor
Found in website/pizzas/static/pizzas/js/admin.js - About 35 mins to fix

Function request has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

function request(method, url, data, success, error) {
Severity: Minor
Found in website/events/static/events/js/admin.js - About 35 mins to fix

Function formfield_for_dbfield has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def formfield_for_dbfield(self, db_field, request, obj=None, **kwargs):
Severity: Minor
Found in website/sales/admin/order_admin.py - About 35 mins to fix

Function setting has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def setting(*, development, production, staging=_NOT_SET, testing=_NOT_SET):
Severity: Minor
Found in website/thaliawebsite/settings.py - About 35 mins to fix

Function test_post has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def test_post(
Severity: Minor
Found in website/payments/tests/test_admin_views.py - About 35 mins to fix

Function save has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save(
Severity: Minor
Found in website/sales/models/shift.py - About 35 mins to fix

Function save has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save(
Severity: Minor
Found in website/sales/models/order.py - About 35 mins to fix

Function save_model has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save_model(self, request, obj, form, change):
Severity: Minor
Found in website/sales/admin/order_admin.py - About 35 mins to fix

Function change_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def change_view(self, request, object_id, form_url="", extra_context=None):
Severity: Minor
Found in website/sales/admin/order_admin.py - About 35 mins to fix

Function changeform_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def changeform_view(self, request, object_id=None, form_url="", extra_context=None):
Severity: Minor
Found in website/sales/admin/order_admin.py - About 35 mins to fix

Function _show_message has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _show_message(
Severity: Minor
Found in website/payments/admin.py - About 35 mins to fix

Function update_thabloid_blacklist_for_user has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def update_thabloid_blacklist_for_user(form, instance, commit, *args, **kwargs):
Severity: Minor
Found in website/thabloid/services.py - About 35 mins to fix

Function save has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save(
Severity: Minor
Found in website/sales/models/order.py - About 35 mins to fix

Function create_image_thumbnail_dict has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def create_image_thumbnail_dict(
Severity: Minor
Found in website/thaliawebsite/api/services.py - About 35 mins to fix

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

def get_event_to_register_for(member):
    for event in Event.objects.filter(published=True).order_by("?"):
        if event.registration_required and not event.reached_participants_limit():
            if member.id not in event.registrations.values_list("member", flat=True):
                return event
Severity: Minor
Found in website/utils/management/commands/createfixtures.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 rows_distributed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def rows_distributed(thelist, n):
    """Break a list into ``n`` rows, distributing columns as evenly as possible across the rows.

    For example::

Severity: Minor
Found in website/newsletters/templatetags/listutil.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 perform_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def perform_create(self, serializer):
        try:
            if serializer.validated_data.get("name"):
                serializer.save(food_event=FoodEvent.current())
            elif can_change_order(self.request.member, FoodEvent.current()):
Severity: Minor
Found in website/pizzas/api/v1/viewsets.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

Severity
Category
Status
Source
Language