svthalia/concrexit

View on GitHub
website/sales/tests/test_models.py

Summary

Maintainability
F
6 days
Test Coverage

File test_models.py has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from unittest.mock import MagicMock

from django.core.exceptions import ValidationError
from django.test import TestCase
from django.utils import timezone
Severity: Minor
Found in website/sales/tests/test_models.py - About 5 hrs to fix

Function test_shift_statistics has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test_shift_statistics(self):
        self.assertEqual(self.shift.total_revenue, 0)
        self.assertEqual(self.shift.total_revenue_paid, 0)

        self.assertEqual(self.shift.num_orders, 0)
Severity: Minor
Found in website/sales/tests/test_models.py - About 1 hr to fix

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

    def test_is_manager(self):
        # @todo Move this test to test_services
        self.member.is_superuser = False
        self.assertFalse(is_manager(self.member, self.shift))

Severity: Major
Found in website/sales/tests/test_models.py and 1 other location - About 1 day to fix
website/sales/tests/test_services.py on lines 56..73

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 204.

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 3 locations. Consider refactoring.
Open

    @classmethod
    def setUpTestData(cls):
        cls.member = Member.objects.filter(last_name="Wiggers").first()

        cls.beer = Product.objects.get(name="beer")
Severity: Major
Found in website/sales/tests/test_models.py and 2 other locations - About 1 day to fix
website/sales/tests/test_models.py on lines 303..321
website/sales/tests/test_services.py on lines 21..39

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 161.

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 3 locations. Consider refactoring.
Open

    @classmethod
    def setUpTestData(cls):
        cls.member = Member.objects.filter(last_name="Wiggers").first()

        cls.beer = Product.objects.get(name="beer")
Severity: Major
Found in website/sales/tests/test_models.py and 2 other locations - About 1 day to fix
website/sales/tests/test_models.py on lines 60..78
website/sales/tests/test_services.py on lines 21..39

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 161.

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 14 locations. Consider refactoring.
Open

        i3 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = OrderItem.objects.create(
            order=order,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i3 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i2 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i2 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = OrderItem.objects.create(
            order=order,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i2 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = OrderItem.objects.create(
            order=order,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i2 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251

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 37.

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 14 locations. Consider refactoring.
Open

        i3 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = OrderItem.objects.create(
            order=order,
            product=self.shift.product_list.product_items.get(product=self.soda),
Severity: Major
Found in website/sales/tests/test_models.py and 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 213..215
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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 14 locations. Consider refactoring.
Open

        i1 = 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 13 other locations - About 55 mins to fix
website/sales/tests/test_models.py on lines 84..86
website/sales/tests/test_models.py on lines 90..92
website/sales/tests/test_models.py on lines 102..104
website/sales/tests/test_models.py on lines 108..110
website/sales/tests/test_models.py on lines 114..116
website/sales/tests/test_models.py on lines 129..131
website/sales/tests/test_models.py on lines 135..137
website/sales/tests/test_models.py on lines 141..143
website/sales/tests/test_models.py on lines 159..161
website/sales/tests/test_models.py on lines 165..167
website/sales/tests/test_models.py on lines 171..173
website/sales/tests/test_models.py on lines 249..251
website/sales/tests/test_models.py on lines 265..267

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 37.

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

        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=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=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

        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

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=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=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=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=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=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

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

There are no issues that match your filters.

Category
Status