gedankenstuecke/twitter-analyser

View on GitHub
tweet_display/views.py

Summary

Maintainability
F
4 days
Test Coverage

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

def index(request, oh_id=None):
    context = {'section': 'general', 'graph_section': True}
    if oh_id is not None:
        context['link_target'] = oh_id
    if grant_access(request, oh_id):
Severity: Major
Found in tweet_display/views.py and 1 other location - About 1 day to fix
tweet_display/views.py on lines 38..49

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

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

def interactions(request, oh_id=None):
    context = {'section': 'interactions', 'graph_section': True}
    if oh_id is not None:
        context['link_target'] = oh_id
    if grant_access(request, oh_id):
Severity: Major
Found in tweet_display/views.py and 1 other location - About 1 day to fix
tweet_display/views.py on lines 10..21

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

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

def top_replies(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='top_replies',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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

def gender_rt(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='gender_rt',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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

def timeline(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='timeline',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 115..121

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

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

def gender_reply(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='gender_reply',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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

def heatmap(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='heatmap',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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

def overall_tweets(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='overall_tweets',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112

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

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

def tweet_types(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='tweet_types',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 70..76
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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

def hourly_tweets(request, oh_id):
    if grant_access(request, oh_id):
        graph = Graph.objects.get(graph_type__exact='hourly_tweets',
                                  open_humans_member__oh_id=oh_id)
        return HttpResponse(graph.graph_data, content_type='application/json')
Severity: Major
Found in tweet_display/views.py and 7 other locations - About 2 hrs to fix
tweet_display/views.py on lines 52..58
tweet_display/views.py on lines 61..67
tweet_display/views.py on lines 79..85
tweet_display/views.py on lines 88..94
tweet_display/views.py on lines 97..103
tweet_display/views.py on lines 106..112
tweet_display/views.py on lines 115..121

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

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