rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Function ajaxHandleResponses has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function ajaxHandleResponses( s, jqXHR, responses ) {
    var firstDataType, ct, finalDataType, type,
        contents = s.contents,
        dataTypes = s.dataTypes;

Severity: Minor
Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

    Function when has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        when: function( subordinate /* , ..., subordinateN */ ) {
            var i = 0,
                resolveValues = slice.call( arguments ),
                length = resolveValues.length,
    
    
    Severity: Minor
    Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

      Function when has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          when: function( subordinate /* , ..., subordinateN */ ) {
              var i = 0,
                  resolveValues = slice.call( arguments ),
                  length = resolveValues.length,
      
      
      Severity: Minor
      Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

        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 extra_stats has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def extra_stats(request):
            """
            Generate extra statistics, dump them as JSON
        
            * Numărul de jucători care au accesat în 95% din zile site-ul
        Severity: Minor
        Found in wouso/interface/apps/statistics/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 launch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def launch(request, to_id):
            lock = challengeLock.lock()
            logging.info("Locked.")
        
            flush_transaction()
        Severity: Minor
        Found in wouso/games/challenge/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

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

                searchresults = Player.objects.filter(Q(user__first_name__icontains=query) | Q(user__last_name__icontains=query) | Q(user__username__icontains=query))
        Severity: Major
        Found in wouso/interface/api/handlers.py and 5 other locations - About 1 hr to fix
        wouso/interface/cpanel/views.py on lines 1345..1347
        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 5 locations. Consider refactoring.
        Open

            @unittest.skip
            def test_4_players(self):
                self._simulate_n_users(4)
                self.assertEqual(GrandChallengeGame.get_winner().id, self._get_player(1).id)
        Severity: Major
        Found in wouso/games/grandchallenge/tests.py and 4 other locations - About 1 hr to fix
        wouso/games/grandchallenge/tests.py on lines 52..55
        wouso/games/grandchallenge/tests.py on lines 57..60
        wouso/games/grandchallenge/tests.py on lines 62..65
        wouso/games/grandchallenge/tests.py on lines 67..70

        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

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

                self.instance.quiz = Quiz.objects.get(name=data['quiz']) if data['quiz'] != '--None--' else None
        Severity: Major
        Found in wouso/interface/apps/lesson/forms.py and 1 other location - About 1 hr to fix
        wouso/interface/apps/lesson/forms.py on lines 47..47

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 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

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

            @unittest.skip
            def test_16_players(self):
                self._simulate_n_users(16)
                self.assertEqual(GrandChallengeGame.get_winner().id, self._get_player(1).id)
        Severity: Major
        Found in wouso/games/grandchallenge/tests.py and 4 other locations - About 1 hr to fix
        wouso/games/grandchallenge/tests.py on lines 47..50
        wouso/games/grandchallenge/tests.py on lines 52..55
        wouso/games/grandchallenge/tests.py on lines 57..60
        wouso/games/grandchallenge/tests.py on lines 67..70

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

            @unittest.skip
            def test_6_players(self):
                self._simulate_n_users(6)
                self.assertEqual(GrandChallengeGame.get_winner().id, self._get_player(1).id)
        Severity: Major
        Found in wouso/games/grandchallenge/tests.py and 4 other locations - About 1 hr to fix
        wouso/games/grandchallenge/tests.py on lines 47..50
        wouso/games/grandchallenge/tests.py on lines 52..55
        wouso/games/grandchallenge/tests.py on lines 62..65
        wouso/games/grandchallenge/tests.py on lines 67..70

        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

                            r = Player.objects.filter(Q(user__first_name__icontains=word) | Q(user__last_name__icontains=word) |
                                                  Q(nickname__icontains=query)
        Severity: Major
        Found in wouso/interface/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/cpanel/views.py on lines 1349..1351
        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

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

        def setup_scoring():
        
            """ Prepare database for Scoring """
            for cc in CORE_POINTS:
                if not Coin.get(cc):
        Severity: Minor
        Found in wouso/core/scoring/sm.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

        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/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/cpanel/views.py on lines 1349..1351
        wouso/interface/views.py on lines 170..171
        wouso/interface/views.py on lines 196..198

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

            @unittest.skip
            def test_16_players(self):
                self._simulate_n_users(17)
                self.assertEqual(GrandChallengeGame.get_winner().id, self._get_player(1).id)
        Severity: Major
        Found in wouso/games/grandchallenge/tests.py and 4 other locations - About 1 hr to fix
        wouso/games/grandchallenge/tests.py on lines 47..50
        wouso/games/grandchallenge/tests.py on lines 52..55
        wouso/games/grandchallenge/tests.py on lines 57..60
        wouso/games/grandchallenge/tests.py on lines 62..65

        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

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

                self.instance.quiz = Quiz.objects.get(name=data['quiz']) if data['quiz'] != '--None--' else None
        Severity: Major
        Found in wouso/interface/apps/lesson/forms.py and 1 other location - About 1 hr to fix
        wouso/interface/apps/lesson/forms.py on lines 87..87

        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

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

        def review(request, workshop):
            player = request.user.get_profile()
            workshop = get_object_or_404(Workshop, pk=workshop)
        
            assessment = workshop.get_assessment(player)
        Severity: Minor
        Found in wouso/games/workshop/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

        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/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/cpanel/views.py on lines 1349..1351
        wouso/interface/views.py on lines 170..171
        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

        Severity
        Category
        Status
        Source
        Language