svthalia/concrexit

View on GitHub
website/pushnotifications/signals/events.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function schedule_event_start_reminder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def schedule_event_start_reminder(sender, instance, **kwargs):
    """Create, update or delete a scheduled start reminder for the event if necessary."""
    message = getattr(instance, "start_reminder", None)

    if not instance.published:
Severity: Minor
Found in website/pushnotifications/signals/events.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

Function schedule_registration_reminder has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def schedule_registration_reminder(sender, instance, **kwargs):
    """Create, update or delete a registration reminder for the event if necessary."""
    message = getattr(instance, "registration_reminder", None)

    if not instance.published or not instance.registration_required:
Severity: Minor
Found in website/pushnotifications/signals/events.py - About 1 hr 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_event_start_reminder_users_on_registration_save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def update_event_start_reminder_users_on_registration_save(sender, instance, **kwargs):
    """Add or remove the member from the event start reminder."""
    message = getattr(instance.event, "start_reminder", None)

    if message is None or message.sent:
Severity: Minor
Found in website/pushnotifications/signals/events.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

There are no issues that match your filters.

Category
Status