svthalia/concrexit

View on GitHub

Showing 227 of 702 total issues

Function test_create_registration has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_create_registration(self, perms_mock):
        self.event.registration_start = timezone.now() - timedelta(hours=2)
        self.event.registration_end = timezone.now() + timedelta(hours=1)

        perms_mock.return_value = {
Severity: Minor
Found in website/events/tests/test_services.py - About 1 hr to fix

Function send_email has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def send_email(
Severity: Major
Found in website/utils/snippets.py - About 1 hr to fix

Function grid_item has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def grid_item(
Severity: Major
Found in website/thaliawebsite/templatetags/grid_item.py - About 1 hr to fix

Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in website/payments/tests/__mocks__.py - About 1 hr to fix

Function validate_unique has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_unique(self, **kwargs):
        try:
            super().validate_unique(**kwargs)
            # Skip checks if group hasn't been saved yet.
            if self.group.id is not None:
Severity: Minor
Found in website/activemembers/models.py - About 55 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 maintain_integrity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def maintain_integrity(func):
    def wrapper(*args, **kwargs):
        try_amnt = 0
        while True:
            try:
Severity: Minor
Found in website/utils/management/commands/createfixtures.py - About 55 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_contacts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _sync_contacts():
    logger.info("Synchronizing contacts...")
    # Make moneybird contacts for people that dont have.
    for member in Member.objects.filter(
        moneybird_contact__isnull=True, profile__is_minimized=False
Severity: Minor
Found in website/moneybirdsynchronization/services.py - About 55 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_registration_by_organiser has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def update_registration_by_organiser(registration, member, data):
    if not is_organiser(member, registration.event):
        raise RegistrationError(_("You are not allowed to update this registration."))

    if "present" in data:
Severity: Minor
Found in website/events/services.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):
        errors = {}
        if (self.member is None and not self.name) or (self.member and self.name):
            errors.update(
                {
Severity: Minor
Found in website/events/models/event_registration.py - About 55 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 registrations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def registrations(self, request, pk):
        """Define a custom route for the event's registrations, can filter on registration status if the user is an organiser.

        :param request: the request object
        :param pk: the primary key of the event
Severity: Minor
Found in website/events/api/v1/viewsets/events.py - About 55 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_changes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clean_changes(self, changed_data):
        """Check if changes from `changed_data` are allowed.

        This method should be run from a form clean() method, where changed_data
        can be retrieved from self.changed_data
Severity: Minor
Found in website/events/models/event.py - About 55 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 schedule_new_album_pushnotification has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def schedule_new_album_pushnotification(sender, instance, **kwargs):
    """Create, update or delete a scheduled message for the saved album if necessary."""
    message = getattr(instance, "new_album_notification", None)

    if instance.hidden or instance.is_processing:
Severity: Minor
Found in website/pushnotifications/signals/photos.py - About 55 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 cancel_order has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def cancel_order(request):
    """View that cancels a user's order."""
    if "order" in request.POST:
        try:
            order = get_object_or_404(FoodOrder, pk=int(request.POST["order"]))
Severity: Minor
Found in website/pizzas/views.py - About 55 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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, *args, require_address=False, **kwargs):
        super().__init__(*args, **kwargs)
        user = Member.objects.get(pk=kwargs["instance"].user_id)
        for field in [
            "birthday",
Severity: Minor
Found in website/members/forms.py - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def save(
        self, force_insert=False, force_update=False, using=None, update_fields=None
    ):
        if self.shift.locked and (
            self._total_amount != 0 or (self._total_amount == 0 and not self._is_free)
Severity: Minor
Found in website/sales/models/order.py - About 55 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 display_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def display_name(self):
        pref = self.display_name_preference
        if pref == "nickname" and self.nickname is not None:
            return f"'{self.nickname}'"
        if pref == "firstname":
Severity: Minor
Found in website/members/models/profile.py - About 55 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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in website/thaliawebsite/api/v2/serializers/thumbnail.py - About 50 mins to fix

Avoid deeply nested control flow statements.
Open

                    if warning := _try_save_photo(album, file, photo):
                        warnings[photo] = warning
                    else:
                        count += 1
        return warnings, count
Severity: Major
Found in website/photos/services.py - About 45 mins to fix

Function update_registration has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def update_registration(
Severity: Minor
Found in website/events/services.py - About 45 mins to fix

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def __init__(
Severity: Minor
Found in website/mailinglists/gsuite.py - About 45 mins to fix
Severity
Category
Status
Source
Language