rosedu/wouso

View on GitHub

Showing 2,707 of 2,707 total issues

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

@register.simple_tag
def get_ass_reviewer_grade(assessment, player):
    """ Render sum of grades from player reviewer, for a specific assessment
    So player reviewed assessment and gave it this results.
    """
Severity: Major
Found in wouso/games/workshop/templatetags/workshop.py and 1 other location - About 2 hrs to fix
wouso/games/workshop/templatetags/workshop.py on lines 33..41

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

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

    def test_partial_correct_and_wrong1(self):
        q = self.get_question(4, 3)
        post = self.fake_answers(q, 3, 2)
        self.assertEqual(Challenge._calculate_points(post)['points'], 8)
Severity: Major
Found in wouso/games/challenge/tests.py and 5 other locations - About 2 hrs to fix
wouso/games/challenge/tests.py on lines 369..372
wouso/games/challenge/tests.py on lines 374..377
wouso/games/challenge/tests.py on lines 384..387
wouso/games/challenge/tests.py on lines 389..392
wouso/games/challenge/tests.py on lines 394..397

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

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

@register.simple_tag
def get_ass_review_grade(assessment, player):
    """ Render sum of review grades for a specific assessment and player

    So player reviewed assessment, and received from the assistant this grade.
Severity: Major
Found in wouso/games/workshop/templatetags/workshop.py and 1 other location - About 2 hrs to fix
wouso/games/workshop/templatetags/workshop.py on lines 23..30

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

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

function ajaxConvert( s, response, jqXHR, isSuccess ) {
    var conv2, current, conv, tmp, prev,
        converters = {},
        // Work with a copy of dataTypes in case we need to modify it for conversion
        dataTypes = s.dataTypes.slice();
Severity: Major
Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

    Function ajaxConvert has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ajaxConvert( s, response, jqXHR, isSuccess ) {
        var conv2, current, conv, tmp, prev,
            converters = {},
            // Work with a copy of dataTypes in case we need to modify it for conversion
            dataTypes = s.dataTypes.slice();
    Severity: Major
    Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix

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

          def form_valid(self, form):
              sg = form.save()
              sg.owner = WorkshopGame.get_instance()
              sg.save()
              return redirect('ws_edit_spot', day=sg.day, hour=sg.hour)
      Severity: Major
      Found in wouso/games/workshop/cpanel.py and 1 other location - About 2 hrs to fix
      wouso/games/workshop/cpanel.py on lines 77..81

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

      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

          def form_valid(self, form):
              sg = form.save()
              sg.owner = WorkshopGame.get_instance()
              sg.save()
              return redirect('ws_edit_spot', day=sg.day, hour=sg.hour)
      Severity: Major
      Found in wouso/games/workshop/cpanel.py and 1 other location - About 2 hrs to fix
      wouso/games/workshop/cpanel.py on lines 57..61

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

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

      def artifact_edit(request, id=None):
          if id is not None:
              instance = get_object_or_404(Artifact, pk=id)
          else:
              instance = None
      Severity: Minor
      Found in wouso/interface/cpanel/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 qpool_home has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def qpool_home(request, cat='qotd', page=u'1', tag=None):
          categories = Category.objects.all()
      
          qs = get_questions_with_category(str(cat), active_only=False,
                                           endorsed_only=False)
      Severity: Minor
      Found in wouso/interface/cpanel/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 4 locations. Consider refactoring.
      Open

                  if self.challenge.user_won.user.magic.has_modifier('challenge-affect-scoring-lost'):
                      self.challenge.user_won.percents += self.challenge.user_won.user.magic.modifier_percents('challenge-affect-scoring-lost') - 100
      Severity: Major
      Found in wouso/games/challenge/models.py and 3 other locations - About 2 hrs to fix
      wouso/games/challenge/models.py on lines 666..667
      wouso/games/challenge/models.py on lines 674..675
      wouso/games/challenge/models.py on lines 688..689

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

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

                  if self.challenge.user_won.user.magic.has_modifier('challenge-affect-scoring'):
                      self.challenge.user_won.percents += self.challenge.user_won.user.magic.modifier_percents('challenge-affect-scoring') - 100
      Severity: Major
      Found in wouso/games/challenge/models.py and 3 other locations - About 2 hrs to fix
      wouso/games/challenge/models.py on lines 666..667
      wouso/games/challenge/models.py on lines 670..671
      wouso/games/challenge/models.py on lines 688..689

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

      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

          for g in os.listdir(themes_dir):
              if os.path.exists(themes_dir + '/' + g + '/styles.css'):
                  themes.append(g)
      Severity: Major
      Found in wouso/utils/__init__.py and 1 other location - About 2 hrs to fix
      wouso/games/__init__.py on lines 7..9

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

      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_cpanel_home_view_has_restricted_access(self):
              self.c.login(username='testuser1', password='test')
              response = self.c.get(reverse('specialquest_cpanel_groups'))
              # Check if user has been redirected
              self.assertEqual(response.status_code, 302)
      Severity: Major
      Found in wouso/games/specialquest/tests.py and 1 other location - About 2 hrs to fix
      wouso/games/specialquest/tests.py on lines 32..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 51.

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

                  if self.challenge.user_lost.user.magic.has_modifier('challenge-affect-scoring'):
                      self.challenge.user_lost.percents += self.challenge.user_lost.user.magic.modifier_percents('challenge-affect-scoring') - 100
      Severity: Major
      Found in wouso/games/challenge/models.py and 3 other locations - About 2 hrs to fix
      wouso/games/challenge/models.py on lines 666..667
      wouso/games/challenge/models.py on lines 670..671
      wouso/games/challenge/models.py on lines 674..675

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

      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

          for g in os.listdir(games_dir):
              if os.path.exists(games_dir + '/' + g + '/urls.py'):
                  res.append(g)
      Severity: Major
      Found in wouso/games/__init__.py and 1 other location - About 2 hrs to fix
      wouso/utils/__init__.py on lines 7..9

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

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

                  if self.challenge.user_won.user.magic.has_modifier('challenge-affect-scoring-won'):
                      self.challenge.user_won.percents += self.challenge.user_won.user.magic.modifier_percents('challenge-affect-scoring-won') - 100
      Severity: Major
      Found in wouso/games/challenge/models.py and 3 other locations - About 2 hrs to fix
      wouso/games/challenge/models.py on lines 670..671
      wouso/games/challenge/models.py on lines 674..675
      wouso/games/challenge/models.py on lines 688..689

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

      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_cpanel_home_view_has_restricted_access(self):
              self.c.login(username='testuser1', password='test')
              response = self.c.get(reverse('specialquest_home'))
              # Check if user has been redirected
              self.assertEqual(response.status_code, 302)
      Severity: Major
      Found in wouso/games/specialquest/tests.py and 1 other location - About 2 hrs to fix
      wouso/games/specialquest/tests.py on lines 44..48

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

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

        Tooltip.prototype.show = function () {
          var e = $.Event('show.bs.' + this.type)
      
          if (this.hasContent() && this.enabled) {
            this.$element.trigger(e)
      Severity: Major
      Found in wouso/resources/static/js/bootstrap.js - About 2 hrs to fix

        Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            remove: function( elem, types, handler, selector, mappedTypes ) {
                var j, handleObj, tmp,
                    origCount, t, events,
                    special, handlers, type,
                    namespaces, origType,
        Severity: Major
        Found in wouso/resources/static/js/jquery.js - About 2 hrs to fix

          Function remove has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              remove: function( elem, types, handler, selector, mappedTypes ) {
                  var j, handleObj, tmp,
                      origCount, t, events,
                      special, handlers, type,
                      namespaces, origType,
          Severity: Major
          Found in wouso/resources/static/js/jquery-1.11.1.min.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language