fossasia/open-event-orga-server

View on GitHub
app/api/schema/orders.py

Summary

Maintainability
B
5 hrs
Test Coverage

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

    event_invoice = Relationship(
        attribute='invoice',
        self_view='v1.order_event_invoice',
        self_view_kwargs={'order_identifier': '<identifier>'},
        related_view='v1.event_invoice_detail',
Severity: Major
Found in app/api/schema/orders.py and 2 other locations - About 1 hr to fix
app/api/schema/groups.py on lines 51..56
app/api/schema/orders.py on lines 134..139

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

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

    user = GetterRelationship(
        getter='safe_user',
        self_view='v1.order_user',
        self_view_kwargs={'order_identifier': '<identifier>'},
        related_view='v1.user_detail',
Severity: Major
Found in app/api/schema/orders.py and 2 other locations - About 1 hr to fix
app/api/schema/groups.py on lines 51..56
app/api/schema/orders.py on lines 155..160

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

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

    discount_code = Relationship(
        self_view='v1.order_discount',
        self_view_kwargs={'order_identifier': '<identifier>'},
        related_view='v1.discount_code_detail',
        related_view_kwargs={'id': '<discount_code_id>'},
Severity: Major
Found in app/api/schema/orders.py and 15 other locations - About 55 mins to fix
app/api/schema/attendees.py on lines 89..93
app/api/schema/attendees.py on lines 98..102
app/api/schema/attendees.py on lines 107..111
app/api/schema/attendees.py on lines 141..145
app/api/schema/events.py on lines 379..383
app/api/schema/events.py on lines 388..392
app/api/schema/events.py on lines 476..480
app/api/schema/events.py on lines 511..515
app/api/schema/groups.py on lines 62..66
app/api/schema/orders.py on lines 145..149
app/api/schema/orders.py on lines 166..170
app/api/schema/speakers.py on lines 74..78
app/api/schema/user_check_in.py on lines 25..29
app/api/schema/user_check_in.py on lines 34..38
app/api/schema/user_check_in.py on lines 43..47

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

    event = Relationship(
        self_view='v1.order_event',
        self_view_kwargs={'order_identifier': '<identifier>'},
        related_view='v1.event_detail',
        related_view_kwargs={'id': '<event_id>'},
Severity: Major
Found in app/api/schema/orders.py and 15 other locations - About 55 mins to fix
app/api/schema/attendees.py on lines 89..93
app/api/schema/attendees.py on lines 98..102
app/api/schema/attendees.py on lines 107..111
app/api/schema/attendees.py on lines 141..145
app/api/schema/events.py on lines 379..383
app/api/schema/events.py on lines 388..392
app/api/schema/events.py on lines 476..480
app/api/schema/events.py on lines 511..515
app/api/schema/groups.py on lines 62..66
app/api/schema/orders.py on lines 166..170
app/api/schema/orders.py on lines 176..180
app/api/schema/speakers.py on lines 74..78
app/api/schema/user_check_in.py on lines 25..29
app/api/schema/user_check_in.py on lines 34..38
app/api/schema/user_check_in.py on lines 43..47

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

    marketer = Relationship(
        self_view='v1.order_marketer',
        self_view_kwargs={'order_identifier': '<identifier>'},
        related_view='v1.user_detail',
        related_view_kwargs={'id': '<marketer_id>'},
Severity: Major
Found in app/api/schema/orders.py and 15 other locations - About 55 mins to fix
app/api/schema/attendees.py on lines 89..93
app/api/schema/attendees.py on lines 98..102
app/api/schema/attendees.py on lines 107..111
app/api/schema/attendees.py on lines 141..145
app/api/schema/events.py on lines 379..383
app/api/schema/events.py on lines 388..392
app/api/schema/events.py on lines 476..480
app/api/schema/events.py on lines 511..515
app/api/schema/groups.py on lines 62..66
app/api/schema/orders.py on lines 145..149
app/api/schema/orders.py on lines 176..180
app/api/schema/speakers.py on lines 74..78
app/api/schema/user_check_in.py on lines 25..29
app/api/schema/user_check_in.py on lines 34..38
app/api/schema/user_check_in.py on lines 43..47

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

There are no issues that match your filters.

Category
Status