rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

def add_user_to_race(username, race_name):
    """Add user to race. Return True if successful. Return False if user or
    race does not exist."""
    player = Player.objects.get(user__username=username)
    if not player:
Severity: Major
Found in wouso/utils/user_util.py and 1 other location - About 4 hrs to fix
wouso/utils/user_util.py on lines 214..227

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

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

File models.py has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Quest will use QPool questions tagged 'quest'
import os
import logging
import datetime
import subprocess
Severity: Minor
Found in wouso/games/quest/models.py - About 4 hrs to fix

    Function defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function defaultPrefilter( elem, props, opts ) {
        /* jshint validthis: true */
        var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
            anim = this,
            orig = {},
    Severity: Major
    Found in wouso/resources/static/js/jquery.js - About 4 hrs to fix

      Function defaultPrefilter has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function defaultPrefilter( elem, props, opts ) {
          /* jshint validthis: true */
          var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
              anim = this,
              orig = {},
      Severity: Major
      Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 4 hrs to fix

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

          function Plugin(option) {
            return this.each(function () {
              var $this   = $(this)
              var data    = $this.data('bs.affix')
              var options = typeof option == 'object' && option
        Severity: Major
        Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 4 hrs to fix
        wouso/resources/static/js/bootstrap.js on lines 1806..1815

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

        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

          function Plugin(option) {
            return this.each(function () {
              var $this   = $(this)
              var data    = $this.data('bs.scrollspy')
              var options = typeof option == 'object' && option
        Severity: Major
        Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 4 hrs to fix
        wouso/resources/static/js/bootstrap.js on lines 2071..2080

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

        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

        function populateTags(category) {
            $.getJSON("/api/category/" + category + "/tags", function (data) {
                selectTagsNode.empty();
                data.forEach(function (tag) {
                    var name = tag.name;
        Severity: Major
        Found in wouso/resources/static/js/cpanel/qpool/qpool_new.js and 2 other locations - About 4 hrs to fix
        wouso/resources/static/js/cpanel/lesson/lesson_tags.js on lines 5..15
        wouso/resources/static/js/cpanel/qpool/add_question.js on lines 5..15

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

        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

        function populateTags(category) {
            $.getJSON("/api/lesson_category/" + category + "/lesson_tags", function(data) {
                selectTagNode.empty();
                data.forEach(function(tag) {
                    var name = tag.name;
        Severity: Major
        Found in wouso/resources/static/js/cpanel/lesson/lesson_tags.js and 2 other locations - About 4 hrs to fix
        wouso/resources/static/js/cpanel/qpool/add_question.js on lines 5..15
        wouso/resources/static/js/cpanel/qpool/qpool_new.js on lines 5..15

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

        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

        function populateTags(category) {
            $.getJSON("/api/category/" + category + "/tags", function (data) {
                selectTagsNode.empty();
                data.forEach(function (tag) {
                    var name = tag.name;
        Severity: Major
        Found in wouso/resources/static/js/cpanel/qpool/add_question.js and 2 other locations - About 4 hrs to fix
        wouso/resources/static/js/cpanel/lesson/lesson_tags.js on lines 5..15
        wouso/resources/static/js/cpanel/qpool/qpool_new.js on lines 5..15

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

        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

                for f in filter(lambda name: name.startswith('answer_'), self.data):
                    id = int(f[len('answer_'):])
                    res[id] = [int(i) for i in self.data.getlist(f)]
        Severity: Major
        Found in wouso/games/quiz/forms.py and 1 other location - About 4 hrs to fix
        wouso/games/challenge/forms.py on lines 16..18

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

        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

                for f in filter(lambda name: name.startswith('answer_'), self.data):
                    id = int(f[len('answer_'):])
                    res[id] = [int(i) for i in self.data.getlist(f)]
        Severity: Major
        Found in wouso/games/challenge/forms.py and 1 other location - About 4 hrs to fix
        wouso/games/quiz/forms.py on lines 31..33

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

        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

        File achievements.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import logging
        from datetime import datetime, timedelta
        from django.utils.translation import ugettext_noop
        from core import scoring
        from core.scoring.sm import score
        Severity: Minor
        Found in wouso/interface/activity/achievements.py - About 4 hrs to fix

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

              def test_manage_player_view_get(self):
                  p1 = self._get_player(1)
                  response = self.client.get(reverse('manage_player', args=[p1.pk]))
                  self.assertEqual(response.status_code, 200)
                  self.assertContains(response, 'testuser1')
          Severity: Major
          Found in wouso/interface/cpanel/tests.py and 1 other location - About 4 hrs to fix
          wouso/interface/cpanel/tests.py on lines 299..304

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              def testUserCreate(self):
                  user, new = User.objects.get_or_create(username='test2')
          
                  profile = user.get_profile()
          
          
          Severity: Major
          Found in wouso/games/challenge/tests.py and 1 other location - About 4 hrs to fix
          wouso/games/qotd/tests.py on lines 35..43

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              def testUserCreate(self):
                  user,new = User.objects.get_or_create(username='_test2')
          
                  profile = user.get_profile()
          
          
          Severity: Major
          Found in wouso/games/qotd/tests.py and 1 other location - About 4 hrs to fix
          wouso/games/challenge/tests.py on lines 49..57

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

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              def test_change_password_view_get(self):
                  p1 = self._get_player(1)
                  response = self.client.get(reverse('change_password', args=[p1.pk]))
                  self.assertEqual(response.status_code, 200)
                  self.assertContains(response, 'Password')
          Severity: Major
          Found in wouso/interface/cpanel/tests.py and 1 other location - About 4 hrs to fix
          wouso/interface/cpanel/tests.py on lines 275..280

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

          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

          File models.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from django.db import models
          from django.db.models import Q, Max
          import logging
          from wouso.core.config.models import IntegerSetting
          from wouso.core.game.models import Game
          Severity: Minor
          Found in wouso/games/grandchallenge/models.py - About 3 hrs to fix

            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

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

                    elif line.startswith(START_CORRECT_ANSWER_MARK) or line.startswith(START_INCORRECT_ANSWER_MARK):
                        if not a_saved:
                            answers.append(a)
                            a_saved = True
            
            
            Severity: Major
            Found in wouso/utils/add_questions.py and 1 other location - About 3 hrs to fix
            wouso/utils/import_questions.py on lines 115..142

            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

            Severity
            Category
            Status
            Source
            Language