rosedu/wouso

View on GitHub
wouso/interface/cpanel/views.py

Summary

Maintainability
F
1 wk
Test Coverage

File views.py has 1025 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import models as auth
Severity: Major
Found in wouso/interface/cpanel/views.py - About 2 days to fix

    Function karma_group_view has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def karma_group_view(request, id):
        group = get_object_or_404(PlayerGroup, pk=id)
        players = group.players.all()
    
        if request.method == 'POST':
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function artifact_edit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def artifact_edit(request, id=None):
        if id is not None:
            instance = get_object_or_404(Artifact, pk=id)
        else:
            instance = None
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function qpool_home has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def qpool_home(request, cat='qotd', page=u'1', tag=None):
        categories = Category.objects.all()
    
        qs = get_questions_with_category(str(cat), active_only=False,
                                         endorsed_only=False)
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function infraction_recheck has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def infraction_recheck(request):
        """ Rerun an infraction check on the current challenge history
    
            The view should allow for other infraction additions. """
        try:
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function question_switch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def question_switch(request, id):
        """ Accept a proposed question """
        question = get_object_or_404(Question, pk=id)
    
        # qproposal - endorse part
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function qpool_set_active_categories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def qpool_set_active_categories(request):
        category = get_object_or_404(Category, name='challenge')
        tags = category.tag_set.all()
        if request.method == 'POST':
            tdict = {}
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function bonus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def bonus(request, player_id):
        player = get_object_or_404(Player, pk=player_id)
    
        if request.method == 'POST':
            form = BonusForm(request.POST)
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function groupset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def groupset(request, id):
        profile = get_object_or_404(Player, pk=id)
    
        from django.forms import ModelForm, SelectMultiple
    
    
    Severity: Minor
    Found in wouso/interface/cpanel/views.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid deeply nested control flow statements.
    Open

                        for chunk in image.chunks():
                            fout.write(chunk)
                instance = form.save()
    Severity: Major
    Found in wouso/interface/cpanel/views.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if karma_points == 0:
                              continue
      
                          # Compute formula and calculate amount of bonus given
                          amount = eval(formula.expression.format(**{'karma_points': karma_points}).split('=')[1])
      Severity: Major
      Found in wouso/interface/cpanel/views.py - About 45 mins to fix

        Function edit_question has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def edit_question(request, id):
            question = get_object_or_404(Question, pk=id)
            categories = [(c.name.capitalize(), c.name) for c in Category.objects.all()]
            answers_range = [str(i) for i in range(1, len(question.answers_all) + 1)]
        
        
        Severity: Minor
        Found in wouso/interface/cpanel/views.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function stafftoggle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def stafftoggle(request, id):
            profile = get_object_or_404(Player, pk=id)
        
            if profile != request.user.get_profile():
                staff_group, new = auth.Group.objects.get_or_create(name='Staff')
        Severity: Minor
        Found in wouso/interface/cpanel/views.py - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function qpool_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def qpool_actions(request):
            action = request.GET.get('action', None)
            qs = request.GET.get('qs', '').split(',')
            qs.remove('')
            qs = map(int, qs)
        Severity: Minor
        Found in wouso/interface/cpanel/views.py - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function qpool_export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def qpool_export(request, cat):
            category = get_object_or_404(Category, name=cat)
            response = HttpResponse(mimetype='text/txt')
            response[
                'Content-Disposition'] = 'attachment; filename=question_%s_export.txt' % slugify(
        Severity: Minor
        Found in wouso/interface/cpanel/views.py - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

        class FeaturesView(TemplateView):
            template_name = 'cpanel/customization/features.html'
        
            def __init__(self, **kwargs):
                super(FeaturesView, self).__init__(**kwargs)
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 1 other location - About 1 day to fix
        wouso/interface/cpanel/views.py on lines 264..281

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

        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

        class GamesView(TemplateView):
            template_name = 'cpanel/customization/games.html'
        
            def __init__(self, **kwargs):
                super(GamesView, self).__init__(**kwargs)
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 1 other location - About 1 day to fix
        wouso/interface/cpanel/views.py on lines 288..306

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

        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

                if p.user_from.count():
                    if p.user_from.all()[0].status == 'P' and p.user_from.all()[
                        0].winner.id != p.user.id:
                        user = p.user.player_ptr
                        id = p.user_from.all()[0].id
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 1 other location - About 5 hrs to fix
        wouso/interface/cpanel/views.py on lines 993..997

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

        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

                if p.user_to.count():
                    if p.user_to.all()[0].status == 'P' and p.user_to.all()[
                        0].winner.id != p.user.id:
                        user = p.user.player_ptr
                        id = p.user_to.all()[0].id
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 1 other location - About 5 hrs to fix
        wouso/interface/cpanel/views.py on lines 988..992

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

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

        @permission_required('config.change_setting')
        def artifact_del(request, id):
            artifact = get_object_or_404(Artifact, pk=id)
        
            artifact.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 129..136
        wouso/interface/cpanel/views.py on lines 184..194
        wouso/interface/cpanel/views.py on lines 518..528
        wouso/interface/cpanel/views.py on lines 1201..1211
        wouso/interface/cpanel/views.py on lines 1247..1257

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

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

        @permission_required('config.change_setting')
        def del_static_page(request, pk):
            page = get_object_or_404(StaticPage, pk=pk)
        
            page.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 129..136
        wouso/interface/cpanel/views.py on lines 184..194
        wouso/interface/cpanel/views.py on lines 518..528
        wouso/interface/cpanel/views.py on lines 812..822
        wouso/interface/cpanel/views.py on lines 1247..1257

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

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

        @permission_required('config.change_setting')
        def formula_delete(request, id):
            formula = get_object_or_404(Formula, pk=id)
            formula.delete()
            go_back = request.META.get('HTTP_REFERER', None)
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 184..194
        wouso/interface/cpanel/views.py on lines 518..528
        wouso/interface/cpanel/views.py on lines 812..822
        wouso/interface/cpanel/views.py on lines 1201..1211
        wouso/interface/cpanel/views.py on lines 1247..1257

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

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

        @permission_required('config.change_setting')
        def qpool_delete(request, id):
            question = get_object_or_404(Question, pk=id)
        
            question.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 129..136
        wouso/interface/cpanel/views.py on lines 184..194
        wouso/interface/cpanel/views.py on lines 812..822
        wouso/interface/cpanel/views.py on lines 1201..1211
        wouso/interface/cpanel/views.py on lines 1247..1257

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

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

        @permission_required('config.change_setting')
        def spell_delete(request, id):
            spell = get_object_or_404(Spell, pk=id)
        
            spell.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 129..136
        wouso/interface/cpanel/views.py on lines 518..528
        wouso/interface/cpanel/views.py on lines 812..822
        wouso/interface/cpanel/views.py on lines 1201..1211
        wouso/interface/cpanel/views.py on lines 1247..1257

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

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

        @permission_required('config.change_setting')
        def del_news(request, pk):
            news = get_object_or_404(NewsItem, pk=pk)
        
            news.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 3 hrs to fix
        wouso/interface/cpanel/views.py on lines 129..136
        wouso/interface/cpanel/views.py on lines 184..194
        wouso/interface/cpanel/views.py on lines 518..528
        wouso/interface/cpanel/views.py on lines 812..822
        wouso/interface/cpanel/views.py on lines 1201..1211

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

        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

        @permission_required('config.change_setting')
        def spell_switch(request, id):
            spell = get_object_or_404(Spell, pk=id)
        
            spell.available = not spell.available
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 2 other locations - About 2 hrs to fix
        wouso/interface/apps/lesson/cpanel_views.py on lines 201..208
        wouso/interface/forum/cpanel_views.py on lines 102..109

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

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

                searchresults = Player.objects.filter(Q(user__in=user_ids) |
                                                      Q(full_name__icontains=query) |
                                                      Q(nickname__icontains=query))
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 1 hr to fix
        wouso/interface/api/handlers.py on lines 55..55
        wouso/interface/cpanel/views.py on lines 1345..1347
        wouso/interface/views.py on lines 170..171
        wouso/interface/views.py on lines 196..198
        wouso/interface/views.py on lines 200..202

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

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

                users = User.objects.filter(Q(first_name__icontains=query) |
                                            Q(last_name__icontains=query) |
                                            Q(username__icontains=query))
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 5 other locations - About 1 hr to fix
        wouso/interface/api/handlers.py on lines 55..55
        wouso/interface/cpanel/views.py on lines 1349..1351
        wouso/interface/views.py on lines 170..171
        wouso/interface/views.py on lines 196..198
        wouso/interface/views.py on lines 200..202

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

        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

            def get_context_data(self, **kwargs):
                context = super(StaticPagesView, self).get_context_data(**kwargs)
                context['pages'] = StaticPage.objects.all()
                return context
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 2 other locations - About 1 hr to fix
        wouso/interface/apps/lesson/cpanel_views.py on lines 20..23
        wouso/interface/forum/cpanel_views.py on lines 17..20

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

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

        @permission_required('config.change_setting')
        def qpool_delete_tag(request, tag):
            tag_obj = get_object_or_404(Tag, pk=tag)
        
            tag_obj.delete()
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 3 other locations - About 1 hr to fix
        wouso/games/quest/cpanel.py on lines 107..111
        wouso/games/quest/cpanel.py on lines 113..117
        wouso/games/specialquest/cpanel.py on lines 180..184

        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

                if 'game' in params and params['game']:
                    objects = objects.filter(game__name=params['game'])
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 2 other locations - About 1 hr to fix
        wouso/interface/cpanel/views.py on lines 1152..1153
        wouso/interface/cpanel/views.py on lines 1154..1155

        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

                if 'user_from' in params and params['user_from']:
                    objects = objects.filter(user_from__nickname=params['user_from'])
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 2 other locations - About 1 hr to fix
        wouso/interface/cpanel/views.py on lines 1150..1151
        wouso/interface/cpanel/views.py on lines 1154..1155

        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

                if 'user_to' in params and params['user_to']:
                    objects = objects.filter(user_from__nickname=params['user_to'])
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 2 other locations - About 1 hr to fix
        wouso/interface/cpanel/views.py on lines 1150..1151
        wouso/interface/cpanel/views.py on lines 1152..1153

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

                response.write(u'tags: %s\n' % ' '.join(t.name for t in q.tags.all()))
        Severity: Minor
        Found in wouso/interface/cpanel/views.py and 1 other location - About 55 mins to fix
        wouso/utils/export_questions.py on lines 21..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 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 2 locations. Consider refactoring.
        Open

        class QPoolManageTagsView(ListView):
            template_name = 'cpanel/qpool_managetags.html'
            context_object_name = 'tags'
        
            def get_queryset(self):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py and 1 other location - About 45 mins to fix
        wouso/interface/cpanel/views.py on lines 1120..1125

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

        class ReportsView(ListView):
            template_name = 'cpanel/reports.html'
            context_object_name = 'reports'
        
            def get_queryset(self):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py and 1 other location - About 45 mins to fix
        wouso/interface/cpanel/views.py on lines 629..634

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

            try:
                q_page = paginator.page(page)
            except (EmptyPage, InvalidPage):
                q_page = paginator.page(paginator.num_pages)
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 4 other locations - About 40 mins to fix
        wouso/interface/apps/pages/views.py on lines 23..26
        wouso/interface/profile/views.py on lines 141..144
        wouso/interface/views.py on lines 33..36
        wouso/interface/views.py on lines 287..290

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

        class RacesEdit(UpdateView):
            model = Race
            template_name = 'cpanel/races/edit_race.html'
            form_class = RaceForm
        
        
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 3 other locations - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1024..1030
        wouso/interface/cpanel/views.py on lines 1042..1048
        wouso/interface/cpanel/views.py on lines 1050..1055

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

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

        class GroupsAdd(CreateView):
            model = PlayerGroup
            template_name = 'cpanel/races/group_create.html'
            form_class = PlayerGroupForm
        
        
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 3 other locations - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1024..1030
        wouso/interface/cpanel/views.py on lines 1033..1039
        wouso/interface/cpanel/views.py on lines 1050..1055

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

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

        class GroupsEdit(CreateView):
            model = PlayerGroup
            template_name = 'cpanel/races/group_edit.html'
            form_class = PlayerGroupForm
            def get_success_url(self):
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 3 other locations - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1024..1030
        wouso/interface/cpanel/views.py on lines 1033..1039
        wouso/interface/cpanel/views.py on lines 1042..1048

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

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

        class RacesAdd(CreateView):
            model = Race
            template_name = 'cpanel/races/create.html'
            form_class = RaceForm
        
        
        Severity: Major
        Found in wouso/interface/cpanel/views.py and 3 other locations - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1033..1039
        wouso/interface/cpanel/views.py on lines 1042..1048
        wouso/interface/cpanel/views.py on lines 1050..1055

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

        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

        class AddNewsView(CreateView):
            template_name = "cpanel/add_news.html"
            model = NewsItem
            form_class = NewsForm
        
        
        Severity: Minor
        Found in wouso/interface/cpanel/views.py and 1 other location - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1083..1089

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

        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

        class RoleAdd(CreateView):
            template_name = 'cpanel/roles_add.html'
            model = Group
            form_class = RoleForm
        
        
        Severity: Minor
        Found in wouso/interface/cpanel/views.py and 1 other location - About 30 mins to fix
        wouso/interface/cpanel/views.py on lines 1223..1229

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

        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

        Expected 2 blank lines, found 1
        Open

        class GroupsEdit(CreateView):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Separate top-level function and class definitions with two blank lines.

        Method definitions inside a class are separated by a single blank
        line.
        
        Extra blank lines may be used (sparingly) to separate groups of
        related functions.  Blank lines may be omitted between a bunch of
        related one-liners (e.g. a set of dummy implementations).
        
        Use blank lines in functions, sparingly, to indicate logical
        sections.
        
        Okay: def a():\n    pass\n\n\ndef b():\n    pass
        Okay: def a():\n    pass\n\n\nasync def b():\n    pass
        Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
        Okay: default = 1\nfoo = 1
        Okay: classify = 1\nfoo = 1
        
        E301: class Foo:\n    b = 0\n    def bar():\n        pass
        E302: def a():\n    pass\n\ndef b(n):\n    pass
        E302: def a():\n    pass\n\nasync def b(n):\n    pass
        E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
        E303: def a():\n\n\n\n    pass
        E304: @decorator\n\ndef a():\n    pass
        E305: def a():\n    pass\na()
        E306: def a():\n    def b():\n        pass\n    def c():\n        pass

        Visually indented line with same indent as next logical line
        Open

                        0].winner.id != p.user.id:
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Continuation lines indentation.

        Continuation lines should align wrapped elements either vertically
        using Python's implicit line joining inside parentheses, brackets
        and braces, or using a hanging indent.
        
        When using a hanging indent these considerations should be applied:
        - there should be no arguments on the first line, and
        - further indentation should be used to clearly distinguish itself
          as a continuation line.
        
        Okay: a = (\n)
        E123: a = (\n    )
        
        Okay: a = (\n    42)
        E121: a = (\n   42)
        E122: a = (\n42)
        E123: a = (\n    42\n    )
        E124: a = (24,\n     42\n)
        E125: if (\n    b):\n    pass
        E126: a = (\n        42)
        E127: a = (24,\n      42)
        E128: a = (24,\n    42)
        E129: if (a or\n    b):\n    pass
        E131: a = (\n    42\n 24)

        Closing bracket does not match visual indentation
        Open

            )
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Continuation lines indentation.

        Continuation lines should align wrapped elements either vertically
        using Python's implicit line joining inside parentheses, brackets
        and braces, or using a hanging indent.
        
        When using a hanging indent these considerations should be applied:
        - there should be no arguments on the first line, and
        - further indentation should be used to clearly distinguish itself
          as a continuation line.
        
        Okay: a = (\n)
        E123: a = (\n    )
        
        Okay: a = (\n    42)
        E121: a = (\n   42)
        E122: a = (\n42)
        E123: a = (\n    42\n    )
        E124: a = (24,\n     42\n)
        E125: if (\n    b):\n    pass
        E126: a = (\n        42)
        E127: a = (24,\n      42)
        E128: a = (24,\n    42)
        E129: if (a or\n    b):\n    pass
        E131: a = (\n    42\n 24)

        Expected 1 blank line, found 0
        Open

            def get_success_url(self):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Separate top-level function and class definitions with two blank lines.

        Method definitions inside a class are separated by a single blank
        line.
        
        Extra blank lines may be used (sparingly) to separate groups of
        related functions.  Blank lines may be omitted between a bunch of
        related one-liners (e.g. a set of dummy implementations).
        
        Use blank lines in functions, sparingly, to indicate logical
        sections.
        
        Okay: def a():\n    pass\n\n\ndef b():\n    pass
        Okay: def a():\n    pass\n\n\nasync def b():\n    pass
        Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
        Okay: default = 1\nfoo = 1
        Okay: classify = 1\nfoo = 1
        
        E301: class Foo:\n    b = 0\n    def bar():\n        pass
        E302: def a():\n    pass\n\ndef b(n):\n    pass
        E302: def a():\n    pass\n\nasync def b(n):\n    pass
        E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
        E303: def a():\n\n\n\n    pass
        E304: @decorator\n\ndef a():\n    pass
        E305: def a():\n    pass\na()
        E306: def a():\n    def b():\n        pass\n    def c():\n        pass

        Expected 2 blank lines, found 1
        Open

        class RolesView(ListView):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Separate top-level function and class definitions with two blank lines.

        Method definitions inside a class are separated by a single blank
        line.
        
        Extra blank lines may be used (sparingly) to separate groups of
        related functions.  Blank lines may be omitted between a bunch of
        related one-liners (e.g. a set of dummy implementations).
        
        Use blank lines in functions, sparingly, to indicate logical
        sections.
        
        Okay: def a():\n    pass\n\n\ndef b():\n    pass
        Okay: def a():\n    pass\n\n\nasync def b():\n    pass
        Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
        Okay: default = 1\nfoo = 1
        Okay: classify = 1\nfoo = 1
        
        E301: class Foo:\n    b = 0\n    def bar():\n        pass
        E302: def a():\n    pass\n\ndef b(n):\n    pass
        E302: def a():\n    pass\n\nasync def b(n):\n    pass
        E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
        E303: def a():\n\n\n\n    pass
        E304: @decorator\n\ndef a():\n    pass
        E305: def a():\n    pass\na()
        E306: def a():\n    def b():\n        pass\n    def c():\n        pass

        Expected 2 blank lines after class or function definition, found 1
        Open

        customization_levels = permission_required('config.change_setting')(
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Separate top-level function and class definitions with two blank lines.

        Method definitions inside a class are separated by a single blank
        line.
        
        Extra blank lines may be used (sparingly) to separate groups of
        related functions.  Blank lines may be omitted between a bunch of
        related one-liners (e.g. a set of dummy implementations).
        
        Use blank lines in functions, sparingly, to indicate logical
        sections.
        
        Okay: def a():\n    pass\n\n\ndef b():\n    pass
        Okay: def a():\n    pass\n\n\nasync def b():\n    pass
        Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
        Okay: default = 1\nfoo = 1
        Okay: classify = 1\nfoo = 1
        
        E301: class Foo:\n    b = 0\n    def bar():\n        pass
        E302: def a():\n    pass\n\ndef b(n):\n    pass
        E302: def a():\n    pass\n\nasync def b(n):\n    pass
        E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
        E303: def a():\n\n\n\n    pass
        E304: @decorator\n\ndef a():\n    pass
        E305: def a():\n    pass\na()
        E306: def a():\n    def b():\n        pass\n    def c():\n        pass

        Do not use bare 'except'
        Open

            except:
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        When catching exceptions, mention specific exceptions when possible.

        Okay: except Exception:
        Okay: except BaseException:
        E722: except:

        Line too long (108 > 100 characters)
        Open

                            amount = eval(formula.expression.format(**{'karma_points': karma_points}).split('=')[1])
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Line too long (109 > 100 characters)
        Open

                            add_activity(player, _('received {amount} {coin} bonus for {karma_points} Karma Points'),
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Limit all lines to a maximum of 79 characters.

        There are still many devices around that are limited to 80 character
        lines; plus, limiting windows to 80 characters makes it possible to
        have several windows side-by-side.  The default wrapping on such
        devices looks ugly.  Therefore, please limit all lines to a maximum
        of 79 characters. For flowing long blocks of text (docstrings or
        comments), limiting the length to 72 characters is recommended.
        
        Reports error E501.

        Visually indented line with same indent as next logical line
        Open

                        0].winner.id != p.user.id:
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Continuation lines indentation.

        Continuation lines should align wrapped elements either vertically
        using Python's implicit line joining inside parentheses, brackets
        and braces, or using a hanging indent.
        
        When using a hanging indent these considerations should be applied:
        - there should be no arguments on the first line, and
        - further indentation should be used to clearly distinguish itself
          as a continuation line.
        
        Okay: a = (\n)
        E123: a = (\n    )
        
        Okay: a = (\n    42)
        E121: a = (\n   42)
        E122: a = (\n42)
        E123: a = (\n    42\n    )
        E124: a = (24,\n     42\n)
        E125: if (\n    b):\n    pass
        E126: a = (\n        42)
        E127: a = (24,\n      42)
        E128: a = (24,\n    42)
        E129: if (a or\n    b):\n    pass
        E131: a = (\n    42\n 24)

        Expected 2 blank lines after class or function definition, found 1
        Open

        races_groups = permission_required('config.change_setting')(
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Separate top-level function and class definitions with two blank lines.

        Method definitions inside a class are separated by a single blank
        line.
        
        Extra blank lines may be used (sparingly) to separate groups of
        related functions.  Blank lines may be omitted between a bunch of
        related one-liners (e.g. a set of dummy implementations).
        
        Use blank lines in functions, sparingly, to indicate logical
        sections.
        
        Okay: def a():\n    pass\n\n\ndef b():\n    pass
        Okay: def a():\n    pass\n\n\nasync def b():\n    pass
        Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
        Okay: default = 1\nfoo = 1
        Okay: classify = 1\nfoo = 1
        
        E301: class Foo:\n    b = 0\n    def bar():\n        pass
        E302: def a():\n    pass\n\ndef b(n):\n    pass
        E302: def a():\n    pass\n\nasync def b(n):\n    pass
        E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
        E303: def a():\n\n\n\n    pass
        E304: @decorator\n\ndef a():\n    pass
        E305: def a():\n    pass\na()
        E306: def a():\n    def b():\n        pass\n    def c():\n        pass

        Closing bracket does not match visual indentation
        Open

            )
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        Continuation lines indentation.

        Continuation lines should align wrapped elements either vertically
        using Python's implicit line joining inside parentheses, brackets
        and braces, or using a hanging indent.
        
        When using a hanging indent these considerations should be applied:
        - there should be no arguments on the first line, and
        - further indentation should be used to clearly distinguish itself
          as a continuation line.
        
        Okay: a = (\n)
        E123: a = (\n    )
        
        Okay: a = (\n    42)
        E121: a = (\n   42)
        E122: a = (\n42)
        E123: a = (\n    42\n    )
        E124: a = (24,\n     42\n)
        E125: if (\n    b):\n    pass
        E126: a = (\n        42)
        E127: a = (24,\n      42)
        E128: a = (24,\n    42)
        E129: if (a or\n    b):\n    pass
        E131: a = (\n    42\n 24)

        .has_key() is deprecated, use 'in'
        Open

            if request.POST.has_key('all_active'):
        Severity: Minor
        Found in wouso/interface/cpanel/views.py by pep8

        The {}.has_key() method is removed in Python 3: use the 'in' operator.

        Okay: if "alph" in d:\n    print d["alph"]
        W601: assert d.has_key('alph')

        There are no issues that match your filters.

        Category
        Status