rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

Function offset has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    offset: function( options ) {
        if ( arguments.length ) {
            return options === undefined ?
                this :
                this.each(function( i ) {
Severity: Minor
Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

    Function * has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            "*": [ function( prop, value ) {
                var tween = this.createTween( prop, value ),
                    target = tween.cur(),
                    parts = rfxnum.exec( value ),
                    unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
    Severity: Minor
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

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

      jQuery.fn.autocomplete = function(url, options, data) {
          // Make sure options exists
          options = options || {};
          // Set url as option
          options.url = url;
      Severity: Minor
      Found in wouso/resources/static/js/jquery.autocomplete.js - About 1 hr to fix

        Function test_final_quest_results_view has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def test_final_quest_results_view(self):
                u1 = self._get_player(1).get_extension(QuestUser)
                u2 = self._get_player(2).get_extension(QuestUser)
                r = Race.objects.create(name='rasa_buna', can_play=True)
                Formula.add('finalquest-ok', expression='points=50*({level}+1)/{level_users}')
        Severity: Minor
        Found in wouso/games/quest/tests.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
                          support.getById && context.nodeType === 9 && documentIsHTML &&
                          Expr.relative[ tokens[1].type ] ) {
          
                      context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
          Severity: Major
          Found in wouso/resources/static/js/jquery.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                    if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
                            support.getById && context.nodeType === 9 && documentIsHTML &&
                            Expr.relative[ tokens[1].type ] ) {
            
                        context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
            Severity: Major
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 1 hr to fix

              Function add_user has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def add_user(username, first_name, last_name, email, password, is_active=False, is_staff=False, is_superuser=False):
              Severity: Major
              Found in wouso/utils/user_util.py - About 1 hr to fix

                Function update_user has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def update_user(username, first_name=None, last_name=None, email=None, password=None, is_active=None, is_staff=None, is_superuser=None):
                Severity: Major
                Found in wouso/utils/user_util.py - About 1 hr to fix

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

                          signals.addActivity.send(sender=None, user_from=player, user_to=player, arguments=dict(id=self.chall.id), action="chall-won", game=None)
                  Severity: Major
                  Found in wouso/interface/activity/tests.py and 1 other location - About 1 hr to fix
                  wouso/interface/activity/tests.py on lines 509..509

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

                  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 not player.magic.has_modifier('ach-level-10'):
                                  if player.level_no >= 10:
                                      cls.earn_achievement(player, 'ach-level-10')
                  Severity: Major
                  Found in wouso/interface/activity/achievements.py and 1 other location - About 1 hr to fix
                  wouso/interface/activity/achievements.py on lines 385..387

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

                  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_disabled(self):
                          settings.API_ENABLED = False
                          response = self.client.get('/request_token')
                          self.assertTrue(response.status_code, 404)
                  Severity: Major
                  Found in wouso/interface/api/tests.py and 1 other location - About 1 hr to fix
                  wouso/interface/api/tests.py on lines 17..20

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

                  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 not player.magic.has_modifier('ach-level-5'):
                                  if player.level_no >= 5:
                                      cls.earn_achievement(player, 'ach-level-5')
                  Severity: Major
                  Found in wouso/interface/activity/achievements.py and 1 other location - About 1 hr to fix
                  wouso/interface/activity/achievements.py on lines 389..391

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

                  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

                          signals.addActivity.send(sender=None, user_from=player, user_to=player, arguments=dict(id=self.chall.id), action="chall-won", game=None)
                  Severity: Major
                  Found in wouso/interface/activity/tests.py and 1 other location - About 1 hr to fix
                  wouso/interface/activity/tests.py on lines 513..513

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

                  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_enabled(self):
                          settings.API_ENABLED = True
                          response = self.client.get('/request_token')
                          self.assertTrue(response.status_code, 200)
                  Severity: Major
                  Found in wouso/interface/api/tests.py and 1 other location - About 1 hr to fix
                  wouso/interface/api/tests.py on lines 22..25

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

                  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

                    Popover.prototype.arrow = function () {
                      return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
                    }
                  Severity: Minor
                  Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 55 mins to fix
                  wouso/resources/static/js/bootstrap.js on lines 1485..1487

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

                  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.arrow = function () {
                      return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
                    }
                  Severity: Minor
                  Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 55 mins to fix
                  wouso/resources/static/js/bootstrap.js on lines 1632..1634

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

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

                  def home(request, quiet=None, box=None):
                  
                      profile = request.user.get_profile()
                      msg_user = profile.get_extension(MessagingUser)
                  
                  
                  Severity: Minor
                  Found in wouso/interface/apps/messaging/views.py - About 55 mins 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 manage_player_set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def manage_player_set(request, player_id, task_id):
                      player = get_object_or_404(SpecialQuestUser, id=player_id)
                      task = get_object_or_404(SpecialQuestTask, id=task_id)
                  
                      if task not in player.done_tasks.all():
                  Severity: Minor
                  Found in wouso/games/specialquest/cpanel.py - About 55 mins 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 process_request has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def process_request(self, request):
                  #        import pprint; pprint.pprint(request.META['HTTP_AUTHORIZATION']);pprint.pprint(request.POST);
                          if not request.user.is_anonymous():
                              try:
                                  profile = request.user.get_profile()
                  Severity: Minor
                  Found in wouso/middleware/seen.py - About 55 mins 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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def main():
                      ulist = User.objects.all()
                      accounts_per_race_dict = {}
                      for u in ulist:
                          p = Player.objects.get(user__username=u.username)
                  Severity: Minor
                  Found in wouso/utils/get_stats.py - About 55 mins 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

                  Severity
                  Category
                  Status
                  Source
                  Language