rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Function autocomplete has 381 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.autocomplete = function(input, options) {
    // Create a link to self
    var me = this;

    // Create jQuery object for input element
Severity: Major
Found in wouso/resources/static/js/jquery.autocomplete.js - About 1 day to fix

    File jquery.form.js has 767 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * jQuery Form Plugin
     * version: 3.14 (30-JUL-2012)
     * @requires jQuery v1.3.2 or later
     *
    Severity: Major
    Found in wouso/resources/static/js/jquery.form.js - About 1 day to fix

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

          def test_this_is_sparta_activity_passed(self):
              Artifact.objects.create(group=None, name='ach-this-is-sparta')
              player1 = self._get_player()
              player2 = self._get_player(2)
              first_seen = datetime.now() + timedelta(days=-7)#barely enough time
      Severity: Major
      Found in wouso/interface/activity/tests.py and 2 other locations - About 1 day to fix
      wouso/interface/activity/tests.py on lines 333..352
      wouso/interface/activity/tests.py on lines 354..373

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

      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 test_this_is_sparta_activity_not_enough_time(self):
              Artifact.objects.create(group=None, name='ach-this-is-sparta')
              player1 = self._get_player()
              player2 = self._get_player(2)
              first_seen = datetime.now() + timedelta(days=-6)#only 6 days have passed
      Severity: Major
      Found in wouso/interface/activity/tests.py and 2 other locations - About 1 day to fix
      wouso/interface/activity/tests.py on lines 333..352
      wouso/interface/activity/tests.py on lines 375..394

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

      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 test_this_is_sparta_activity_not_enough_challenges(self):
              Artifact.objects.create(group=None, name='ach-this-is-sparta')
              player1 = self._get_player()
              player2 = self._get_player(2)
              first_seen = datetime.now() + timedelta(days=-10)#10 days since first login
      Severity: Major
      Found in wouso/interface/activity/tests.py and 2 other locations - About 1 day to fix
      wouso/interface/activity/tests.py on lines 354..373
      wouso/interface/activity/tests.py on lines 375..394

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

      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 fileUploadIframe has 337 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function fileUploadIframe(a) {
              var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
              var useProp = !!$.fn.prop;
      
              if ($(':input[name=submit],:input[id=submit]', form).length) {
      Severity: Major
      Found in wouso/resources/static/js/jquery.form.js - About 1 day to fix

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

                    if not q_saved:
                        if len(answers) == 0:
                            q['answer_type'] = ANSWER_TYPE_FREE_TEXT
                        elif num_correct_answers <= 1:
                            q['answer_type'] = ANSWER_TYPE_SINGLE_CHOICE
        Severity: Major
        Found in wouso/utils/add_questions.py and 1 other location - About 1 day to fix
        wouso/utils/add_questions.py on lines 170..188

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

        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

            if not q_saved:
                if len(answers) == 0:
                    q['answer_type'] = ANSWER_TYPE_FREE_TEXT
                elif num_correct_answers <= 1:
                    q['answer_type'] = ANSWER_TYPE_SINGLE_CHOICE
        Severity: Major
        Found in wouso/utils/add_questions.py and 1 other location - About 1 day to fix
        wouso/utils/add_questions.py on lines 98..116

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

        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_early_bird_not(self):
                player = self._get_player()
                Artifact.objects.create(group=None, name='ach-early-bird')
                for i in range(1,2):
                    Activity.objects.create(timestamp=datetime(2012,9,17,6,0,0),
        Severity: Major
        Found in wouso/interface/activity/tests.py and 1 other location - About 1 day to fix
        wouso/interface/activity/tests.py on lines 105..121

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 175.

        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_night_owl_not(self):
                player = self._get_player()
                Artifact.objects.create(group=None, name='ach-night-owl')
                for i in range(1,3):
                    Activity.objects.create(timestamp=datetime(2012,9,17,6,0,0),
        Severity: Major
        Found in wouso/interface/activity/tests.py and 1 other location - About 1 day to fix
        wouso/interface/activity/tests.py on lines 73..89

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

        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_scoring_loss(self):
                initial_points = 10
                winner = self._get_player(1).get_extension(ChallengeUser)
                loser = self._get_player(2).get_extension(ChallengeUser)
        
        
        Severity: Major
        Found in wouso/games/challenge/tests.py and 1 other location - About 1 day to fix
        wouso/games/challenge/tests.py on lines 140..163

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

        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_scoring_win(self):
                initial_points = 10
                winner = self._get_player(1).get_extension(ChallengeUser)
                loser = self._get_player(2).get_extension(ChallengeUser)
        
        
        Severity: Major
        Found in wouso/games/challenge/tests.py and 1 other location - About 1 day to fix
        wouso/games/challenge/tests.py on lines 165..188

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

        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 656 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import random
        from datetime import datetime, time, timedelta, date
        from random import shuffle
        import pickle as pk
        import sys
        Severity: Major
        Found in wouso/games/challenge/models.py - About 1 day to fix

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

              def test_cure_positive(self):
                  """
                   Cure should not remove positive spells
                  """
                  player = self._get_player()
          Severity: Major
          Found in wouso/core/magic/tests.py and 1 other location - About 1 day to fix
          wouso/core/magic/tests.py on lines 161..174

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

          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_cure_negative(self):
                  """
                   Test if cure works on a negative spell
                  """
                  player = self._get_player()
          Severity: Major
          Found in wouso/core/magic/tests.py and 1 other location - About 1 day to fix
          wouso/core/magic/tests.py on lines 176..189

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

          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 tests.py has 632 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from datetime import datetime, timedelta
          from wouso.core.magic.models import Artifact, Spell, SpellHistory
          from wouso.core.magic.manager import MagicManager
          from wouso.core.tests import WousoTest
          from wouso.core import scoring, signals
          Severity: Major
          Found in wouso/interface/activity/tests.py - About 1 day to fix

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

            @permission_required('config.change_setting')
            def forum_actions(request):
                action = request.GET.get('action', None)
                f_id = request.GET.get('f_id', '').split()
                f_id = map(int, f_id)
            Severity: Major
            Found in wouso/interface/forum/cpanel_views.py and 1 other location - About 1 day to fix
            wouso/interface/apps/lesson/cpanel_views.py on lines 211..229

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

            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

            @permission_required('config.change_setting')
            def lesson_actions(request):
                action = request.GET.get('action', None)
                l_id = request.GET.get('l_id', '').split()
                l_id = map(int, l_id)
            Severity: Major
            Found in wouso/interface/apps/lesson/cpanel_views.py and 1 other location - About 1 day to fix
            wouso/interface/forum/cpanel_views.py on lines 112..130

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

            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

              Tooltip.prototype.enter = function (obj) {
                var self = obj instanceof this.constructor ?
                  obj : $(obj.currentTarget).data('bs.' + this.type)
            
                if (!self) {
            Severity: Major
            Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 1 day to fix
            wouso/resources/static/js/bootstrap.js on lines 1222..1240

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

            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

              Tooltip.prototype.leave = function (obj) {
                var self = obj instanceof this.constructor ?
                  obj : $(obj.currentTarget).data('bs.' + this.type)
            
                if (!self) {
            Severity: Major
            Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 1 day to fix
            wouso/resources/static/js/bootstrap.js on lines 1202..1220

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

            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