rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Function add has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    add: function( elem, types, handler, data, selector ) {
        var tmp, events, t, handleObjIn,
            special, eventHandle, handleObj,
            handlers, type, namespaces, origType,
            elemData = jQuery._data( elem );
Severity: Major
Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

    Function manage_player has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def manage_player(request, player_id):
        player = get_object_or_404(Player, pk=player_id)
        player = player.get_extension(SpecialQuestUser)
        tasks_not_done = SpecialQuestTask.objects.exclude(id__in=player.done_tasks.all().values('id')).all()
    
    
    Severity: Minor
    Found in wouso/games/specialquest/cpanel.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 try_using_truncate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def try_using_truncate(username, first_name, last_name, email, password, cookie):
        (username, ret) = try_using_truncate_no_recurse(username, first_name, last_name, email, password)
    
        if ret == OP_SUCCESS:
            return (username, True)
    Severity: Minor
    Found in wouso/utils/add_users_force_to_race.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 try_using_truncate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def try_using_truncate(username, first_name, last_name, email, password, cookie):
        (username, ret) = try_using_truncate_no_recurse(username, first_name, last_name, email, password)
    
        if ret == OP_SUCCESS:
            return (username, True)
    Severity: Minor
    Found in wouso/utils/add_users_force.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 2 locations. Consider refactoring.
    Open

    def sidebar_widget(context):
        user = context.get('user', None)
        if not user or not user.is_authenticated():
            return ''
    
    
    Severity: Major
    Found in wouso/interface/apps/files/views.py and 1 other location - About 2 hrs to fix
    wouso/interface/apps/lesson/views.py on lines 86..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 61.

    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 sidebar_widget(context):
        user = context.get('user', None)
        if not user or not user.is_authenticated():
            return ''
    
    
    Severity: Major
    Found in wouso/interface/apps/lesson/views.py and 1 other location - About 2 hrs to fix
    wouso/interface/apps/files/views.py on lines 21..29

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

    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

        @classmethod
        def get_group_activiy(cls, group, **kwargs):
            """
            Return all group activity
            """
    Severity: Major
    Found in wouso/interface/activity/models.py and 1 other location - About 2 hrs to fix
    wouso/interface/activity/models.py on lines 85..91

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

    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

        @classmethod
        def get_race_activity(cls, race, **kwargs):
            """
            Return all group activity
            """
    Severity: Major
    Found in wouso/interface/activity/models.py and 1 other location - About 2 hrs to fix
    wouso/interface/activity/models.py on lines 93..99

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

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

    from django.db.models import Sum
    import logging
    import sys
    from datetime import datetime, timedelta
    from django.db import models
    Severity: Minor
    Found in wouso/interface/top/models.py - About 2 hrs to fix

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

                      if len(answers) == 0:
                          q['answer_type'] = 'F'
                      elif nr_correct == 1:
                          q['answer_type'] = 'R'
                      else:
      Severity: Major
      Found in wouso/utils/import_questions.py and 1 other location - About 2 hrs to fix
      wouso/utils/import_questions.py on lines 154..159

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

      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 len(answers) == 0:
                  q['answer_type'] = 'F'
              elif nr_correct == 1:
                  q['answer_type'] = 'R'
              else:
      Severity: Major
      Found in wouso/utils/import_questions.py and 1 other location - About 2 hrs to fix
      wouso/utils/import_questions.py on lines 87..92

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

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

              function doSubmit() {
                  // make sure form attrs are set
                  var t = $form.attr('target'), a = $form.attr('action');
      
                  // update form attrs in IE friendly way
      Severity: Major
      Found in wouso/resources/static/js/jquery.form.js - About 2 hrs to fix

        Function matcherFromGroupMatchers has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
            var bySet = setMatchers.length > 0,
                byElement = elementMatchers.length > 0,
                superMatcher = function( seed, context, xml, results, outermost ) {
                    var elem, j, matcher,
        Severity: Major
        Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

          Function matcherFromGroupMatchers has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
              var bySet = setMatchers.length > 0,
                  byElement = elementMatchers.length > 0,
                  superMatcher = function( seed, context, xml, results, outermost ) {
                      var elem, j, matcher,
          Severity: Major
          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

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

            # coding=utf-8
            import logging
            from md5 import md5
            from datetime import datetime, timedelta
            from random import shuffle
            Severity: Minor
            Found in wouso/core/user/models.py - About 2 hrs to fix

              Function done has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function done( status, nativeStatusText, responses, headers ) {
                          var isSuccess, success, error, response, modified,
                              statusText = nativeStatusText;
              
                          // Called once
              Severity: Major
              Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

                Function done has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function done( status, nativeStatusText, responses, headers ) {
                            var isSuccess, success, error, response, modified,
                                statusText = nativeStatusText;
                
                            // Called once
                Severity: Major
                Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

                  Player has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Player(models.Model):
                      """ Base class for the game user. This is extended by game specific
                      player models.
                      """
                      user = models.ForeignKey(User, unique=True, related_name="%(class)s_related")
                  Severity: Minor
                  Found in wouso/core/user/models.py - About 2 hrs to fix

                    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

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

                    class GroupMembersHandler(BaseHandler, MembersMixin):
                        allowed_methods = ('GET',)
                    
                        def read(self, request, group_id):
                            group = get_object_or_404(PlayerGroup, pk=group_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 554..560

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language