svthalia/concrexit

View on GitHub

Showing 601 of 702 total issues

Avoid deeply nested control flow statements.
Open

                            if not input_value.strip():
                                user_data[field_name] = None
                                self.stderr.write("Error: This field cannot be blank.")
                                continue
                            user_data[field_name] = [
Severity: Major
Found in website/members/management/commands/createmember.py - About 45 mins to fix

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

    def save(
        self, force_insert=False, force_update=False, using=None, update_fields=None
    ):
        if self.order.shift.locked:
            raise ValueError("The shift this order belongs to is locked.")
Severity: Minor
Found in website/sales/models/order.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 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

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o3,
            product=self.shift.product_list.product_items.get(product=self.wine),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o4,
            product=self.shift.product_list.product_items.get(product=self.wine),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o2,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o3,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=order4,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o1,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o5,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        with self.assertRaises(ValueError):
            OrderItem.objects.create(
                order=order,
                product=self.shift.product_list.product_items.get(product=self.wine),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=order,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=order2,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=order3,
            product=self.shift.product_list.product_items.get(product=self.beer),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421
website/sales/tests/test_models.py on lines 424..426

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    receive_category = ManyRelatedField(
        allow_empty=True,
        required=False,
        child_relation=PrimaryKeyRelatedField(
            allow_empty=True, queryset=Category.objects.all(), required=False
Severity: Minor
Found in website/pushnotifications/api/v1/serializers.py and 1 other location - About 45 mins to fix
website/pushnotifications/api/v2/serializers.py on lines 36..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            with self.subTest("Already has study-time membership."):
                with self.assertRaises(PaymentError):
                    create_payment(self.renewal, self.admin, Payment.CASH)
Severity: Minor
Found in website/registrations/tests/test_services.py and 1 other location - About 45 mins to fix
website/registrations/tests/test_services.py on lines 556..558

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    receive_category = ManyRelatedField(
        allow_empty=True,
        required=False,
        child_relation=PrimaryKeyRelatedField(
            allow_empty=True, queryset=Category.objects.all(), required=False
Severity: Minor
Found in website/pushnotifications/api/v2/serializers.py and 1 other location - About 45 mins to fix
website/pushnotifications/api/v1/serializers.py on lines 8..12

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            with self.subTest("Already has study-time membership."):
                with self.assertRaises(PaymentError):
                    create_payment(self.renewal, self.admin, Payment.CASH)
Severity: Minor
Found in website/registrations/tests/test_services.py and 1 other location - About 45 mins to fix
website/registrations/tests/test_services.py on lines 563..565

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 12 locations. Consider refactoring.
Open

        OrderItem.objects.create(
            order=o5,
            product=self.shift.product_list.product_items.get(product=self.wine),
Severity: Major
Found in website/sales/tests/test_models.py and 11 other locations - About 45 mins to fix
website/sales/tests/test_models.py on lines 197..199
website/sales/tests/test_models.py on lines 233..236
website/sales/tests/test_models.py on lines 335..337
website/sales/tests/test_models.py on lines 343..345
website/sales/tests/test_models.py on lines 351..353
website/sales/tests/test_models.py on lines 390..392
website/sales/tests/test_models.py on lines 396..398
website/sales/tests/test_models.py on lines 402..404
website/sales/tests/test_models.py on lines 407..409
website/sales/tests/test_models.py on lines 413..415
website/sales/tests/test_models.py on lines 419..421

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language