rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

class RaceMembersHandler(BaseHandler, MembersMixin):
    allowed_methods = ('GET',)

    def read(self, request, race_id):
        race = get_object_or_404(Race, pk=race_id)
Severity: Major
Found in wouso/interface/api/handlers.py and 1 other location - About 2 hrs to fix
wouso/interface/api/handlers.py on lines 563..569

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

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

    @property
    def inactive_quizzes(self):
        through = UserToQuiz.objects.filter(user=self)
        inactive_quizzes = [t for t in through \
        if t.quiz.is_inactive() and t.quiz.is_public()]
Severity: Major
Found in wouso/games/quiz/models.py and 1 other location - About 2 hrs to fix
wouso/games/quiz/models.py on lines 160..166

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

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

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
    if ( postFilter && !postFilter[ expando ] ) {
        postFilter = setMatcher( postFilter );
    }
    if ( postFinder && !postFinder[ expando ] ) {
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

    Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
        if ( postFilter && !postFilter[ expando ] ) {
            postFilter = setMatcher( postFilter );
        }
        if ( postFinder && !postFinder[ expando ] ) {
    Severity: Major
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

      Function doSort has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function doSort($this, $table) {
              var sortColumn = parseFloat($this.attr('data-sortcolumn')),
                  context = lookupSortContext($table),
                  bsSort = context.bsSort;
      
      
      Severity: Major
      Found in wouso/resources/static/js/bootstrap-sortable.js - About 2 hrs to fix

        Function search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def search(request):
            """ Perform regular search by either first or last name """
            logger.debug('Initiating regular search')
            form = SearchForm(request.POST)
            if form.is_valid():
        Severity: Minor
        Found in wouso/interface/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 magic_cast has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        def magic_cast(request, destination=None, spell=None):
            player = request.user.get_profile()
            destination = get_object_or_404(Player, pk=destination)
        
            error = ''
        Severity: Minor
        Found in wouso/interface/apps/magic/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

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

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

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

        @permission_required('config.change_setting')
        def lesson_switch_active(request, id):
            lesson = get_object_or_404(Lesson, pk=id)
        
            lesson.active = not lesson.active
        Severity: Major
        Found in wouso/interface/apps/lesson/cpanel_views.py and 2 other locations - About 2 hrs to fix
        wouso/interface/cpanel/views.py on lines 197..204
        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 3 locations. Consider refactoring.
        Open

                if action == 'refuse':
                    if challenge.user_to.user == challuser and challenge.is_launched():
                        challenge.refuse()
                        return {'success': True}
                    else:
        Severity: Major
        Found in wouso/games/challenge/api.py and 2 other locations - About 2 hrs to fix
        wouso/games/challenge/api.py on lines 100..105
        wouso/games/challenge/api.py on lines 106..111

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

                if action == 'accept':
                    if challenge.user_to.user == challuser and challenge.is_launched():
                        challenge.accept()
                        return {'success': True}
                    else:
        Severity: Major
        Found in wouso/games/challenge/api.py and 2 other locations - About 2 hrs to fix
        wouso/games/challenge/api.py on lines 94..99
        wouso/games/challenge/api.py on lines 100..105

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

            def set_order(self, order):
                self.order = ''
                for i in order:
                    self.order += i + ','
                self.order = self.order[:-1]
        Severity: Major
        Found in wouso/interface/apps/lesson/models.py and 2 other locations - About 2 hrs to fix
        wouso/games/quest/models.py on lines 251..256
        wouso/interface/apps/lesson/models.py on lines 89..94

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

            def reorder(self, order):
                self.order = ''
                for i in order:
                    self.order += i + ','
                self.order = self.order[:-1]
        Severity: Major
        Found in wouso/games/quest/models.py and 2 other locations - About 2 hrs to fix
        wouso/interface/apps/lesson/models.py on lines 41..46
        wouso/interface/apps/lesson/models.py on lines 89..94

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

            def set_order(self, order):
                self.order = ''
                for i in order:
                    self.order += i + ','
                self.order = self.order[:-1]
        Severity: Major
        Found in wouso/interface/apps/lesson/models.py and 2 other locations - About 2 hrs to fix
        wouso/games/quest/models.py on lines 251..256
        wouso/interface/apps/lesson/models.py on lines 41..46

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

                if action == 'cancel':
                    if challenge.user_from.user == challuser and challenge.is_launched():
                        challenge.cancel()
                        return {'success': True}
                    else:
        Severity: Major
        Found in wouso/games/challenge/api.py and 2 other locations - About 2 hrs to fix
        wouso/games/challenge/api.py on lines 94..99
        wouso/games/challenge/api.py on lines 106..111

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

        File user_util.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env/python
        
        # To test, run from parent folder using commands such as:
        # PYTHONPATH=../:. python utils/user_util.py --list-users
        # PYTHONPATH=../:. python utils/user_util.py --list-races
        Severity: Minor
        Found in wouso/utils/user_util.py - About 2 hrs to fix

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

              def clean(self):
                  password1 = self.cleaned_data.get('password')
                  password2 = self.cleaned_data.get('confirm_password')
                  if password1 != password2:
                      raise forms.ValidationError("Passwords don't match")
          Severity: Major
          Found in wouso/interface/cpanel/forms.py and 2 other locations - About 2 hrs to fix
          wouso/interface/cpanel/forms.py on lines 271..276
          wouso/interface/cpanel/forms.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 56.

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

                  def clean(self):
                      password1 = self.cleaned_data.get('password')
                      password2 = self.cleaned_data.get('confirm_password')
                      if password1 != password2:
                          raise forms.ValidationError("Passwords don't match")
          Severity: Major
          Found in wouso/interface/cpanel/forms.py and 2 other locations - About 2 hrs to fix
          wouso/interface/cpanel/forms.py on lines 299..304
          wouso/interface/cpanel/forms.py on lines 329..334

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

          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 race_id:
                      try:
                          race = Race.objects.get(pk=race_id)
                      except Race.DoesNotExist:
                          return rc.NOT_FOUND
          Severity: Major
          Found in wouso/interface/api/handlers.py and 1 other location - About 2 hrs to fix
          wouso/interface/api/handlers.py on lines 462..475

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

          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