neelxie/ireport-api

View on GitHub
app/views/intervention_views.py

Summary

Maintainability
A
3 hrs
Test Coverage

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

@intervention_bp.route('/interventions/<int:incident_id>/status', methods=['PATCH'])
@token_required
@admin_route
def change_status(incident_id):
    """ This is an Admin only route to change record intervention status.
Severity: Major
Found in app/views/intervention_views.py and 3 other locations - About 45 mins to fix
app/views/redflag_views.py on lines 58..64
app/views/user_views.py on lines 48..54
app/views/user_views.py on lines 57..63

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

@intervention_bp.route('/interventions/<int:incident_id>', methods=['GET'])
@token_required
def get_specific_intervention(incident_id):
    """ This route fetchs a single intervention.
    """
Severity: Major
Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
app/views/intervention_views.py on lines 36..41
app/views/intervention_views.py on lines 44..49
app/views/intervention_views.py on lines 61..66
app/views/redflag_views.py on lines 34..39
app/views/redflag_views.py on lines 42..47
app/views/redflag_views.py on lines 50..55
app/views/redflag_views.py on lines 67..72

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

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

@intervention_bp.route('/interventions/<int:incident_id>/location', methods=['PATCH'])
@token_required
def new_location(incident_id):
    """ App Route to edit a intervention location.
    """
Severity: Major
Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
app/views/intervention_views.py on lines 28..33
app/views/intervention_views.py on lines 44..49
app/views/intervention_views.py on lines 61..66
app/views/redflag_views.py on lines 34..39
app/views/redflag_views.py on lines 42..47
app/views/redflag_views.py on lines 50..55
app/views/redflag_views.py on lines 67..72

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

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

@intervention_bp.route('/interventions/<int:incident_id>', methods=["DELETE"])
@token_required
def delete_record(incident_id):
    """ Route to delete a intervention.
    """
Severity: Major
Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
app/views/intervention_views.py on lines 28..33
app/views/intervention_views.py on lines 36..41
app/views/intervention_views.py on lines 44..49
app/views/redflag_views.py on lines 34..39
app/views/redflag_views.py on lines 42..47
app/views/redflag_views.py on lines 50..55
app/views/redflag_views.py on lines 67..72

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

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

@intervention_bp.route('/interventions/<int:incident_id>/comment', methods=['PATCH'])
@token_required
def edit_record_comment(incident_id):
    """ This route changes record comment of a single interventions.
    """
Severity: Major
Found in app/views/intervention_views.py and 7 other locations - About 40 mins to fix
app/views/intervention_views.py on lines 28..33
app/views/intervention_views.py on lines 36..41
app/views/intervention_views.py on lines 61..66
app/views/redflag_views.py on lines 34..39
app/views/redflag_views.py on lines 42..47
app/views/redflag_views.py on lines 50..55
app/views/redflag_views.py on lines 67..72

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

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