rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

        for i in range(wrong_answers):
            Answer.objects.create(question=q, correct=False, text='wrong %d' % i)
Severity: Minor
Found in wouso/games/challenge/tests.py and 1 other location - About 45 mins to fix
wouso/games/challenge/tests.py on lines 352..353

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

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

        return Challenge.objects.filter(date__lt=yesterday).filter(Q(status='A') | Q(status='L'))
Severity: Minor
Found in wouso/games/challenge/models.py and 1 other location - About 45 mins to fix
wouso/interface/apps/statistics/views.py on lines 63..64

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

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 self.chall.status == 'R':
            messages.error(request, _('The challenge was refused!'))
            return redirect('challenge_index_view')
Severity: Minor
Found in wouso/games/challenge/views.py and 1 other location - About 45 mins to fix
wouso/games/challenge/views.py on lines 71..73

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

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-use-all-spells'):
                if used_all_spells(player, False):
                    cls.earn_achievement(player, 'ach-use-all-spells')
Severity: Minor
Found in wouso/interface/activity/achievements.py and 1 other location - About 45 mins to fix
wouso/interface/activity/achievements.py on lines 373..375

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

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

    return $e.attr('data-content')
      || (typeof o.content == 'function' ?
            o.content.call($e[0]) :
            o.content)
Severity: Minor
Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 40 mins to fix
wouso/resources/static/js/bootstrap.js on lines 1469..1470

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

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

    title = $e.attr('data-original-title')
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
Severity: Minor
Found in wouso/resources/static/js/bootstrap.js and 1 other location - About 40 mins to fix
wouso/resources/static/js/bootstrap.js on lines 1626..1629

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

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

Consider simplifying this complex logical expression.
Open

    if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
        return;
    }
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

    if ( !support.opacity ) {
        jQuery.cssHooks.opacity = {
            get: function( elem, computed ) {
                // IE uses filters for opacity
                return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
    Severity: Major
    Found in wouso/resources/static/js/jquery.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if ( s.crossDomain == null ) {
                  parts = rurl.exec( s.url.toLowerCase() );
                  s.crossDomain = !!( parts &&
                      ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
                          ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
      Severity: Major
      Found in wouso/resources/static/js/jquery.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

            if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
                return;
            }
        Severity: Major
        Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

          if ( !support.opacity ) {
              jQuery.cssHooks.opacity = {
                  get: function( elem, computed ) {
                      // IE uses filters for opacity
                      return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
          Severity: Major
          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                        if ( matcher[ expando ] ) {
                            // Find the next relative operator (if any) for proper handling
                            j = ++i;
                            for ( ; j < len; j++ ) {
                                if ( Expr.relative[ tokens[j].type ] ) {
            Severity: Major
            Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                  if ( support.matchesSelector && documentIsHTML &&
                      ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                      ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
              
                      try {
              Severity: Major
              Found in wouso/resources/static/js/jquery.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if ( matcher[ expando ] ) {
                                // Find the next relative operator (if any) for proper handling
                                j = ++i;
                                for ( ; j < len; j++ ) {
                                    if ( Expr.relative[ tokens[j].type ] ) {
                Severity: Major
                Found in wouso/resources/static/js/jquery.js - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if ( s.crossDomain == null ) {
                              parts = rurl.exec( s.url.toLowerCase() );
                              s.crossDomain = !!( parts &&
                                  ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
                                      ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
                  Severity: Major
                  Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                        if ( support.matchesSelector && documentIsHTML &&
                            ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
                            ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
                    
                            try {
                    Severity: Major
                    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 40 mins to fix

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

                          try:
                              activity = paginator.page(page)
                          except (EmptyPage, InvalidPage):
                              activity = paginator.page(paginator.num_pages)
                      Severity: Major
                      Found in wouso/interface/views.py and 4 other locations - About 40 mins to fix
                      wouso/interface/apps/pages/views.py on lines 23..26
                      wouso/interface/cpanel/views.py on lines 395..398
                      wouso/interface/profile/views.py on lines 141..144
                      wouso/interface/views.py on lines 287..290

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

                      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

                          result = History.objects.filter(user=player.user, coin=coin).aggregate(total=models.Sum('amount'))
                      Severity: Minor
                      Found in wouso/core/scoring/sm.py and 1 other location - About 40 mins to fix
                      wouso/core/scoring/sm.py on lines 270..270

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

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

                          try:
                              activity = paginator.page(page)
                          except (EmptyPage, InvalidPage):
                              activity = paginator.page(paginator.num_pages)
                      Severity: Major
                      Found in wouso/interface/views.py and 4 other locations - About 40 mins to fix
                      wouso/interface/apps/pages/views.py on lines 23..26
                      wouso/interface/cpanel/views.py on lines 395..398
                      wouso/interface/profile/views.py on lines 141..144
                      wouso/interface/views.py on lines 33..36

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

                      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

                          result = History.objects.filter(user=player.user, coin=coin).aggregate(total=models.Sum('amount'))
                      Severity: Minor
                      Found in wouso/core/scoring/sm.py and 1 other location - About 40 mins to fix
                      wouso/core/scoring/sm.py on lines 262..262

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

                      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