rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

Avoid too many return statements within this function.
Open

            return False, 'Player is cursed'
Severity: Major
Found in wouso/core/god/god.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return False
    Severity: Major
    Found in wouso/games/quest/models.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return "%s %s %s" % (self.type, self.user_from, self.spell)
      Severity: Major
      Found in wouso/core/magic/models.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return False, 'Player already has this spell cast on him'
        Severity: Major
        Found in wouso/core/god/god.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return redirect('challenge_index_view')
          Severity: Major
          Found in wouso/games/challenge/views.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return {'success': True, 'result': result}
            Severity: Major
            Found in wouso/games/challenge/api.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return answer.strip().lower() in answers
              Severity: Major
              Found in wouso/games/quest/models.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return render_to_response('workshop/play.html',
                Severity: Major
                Found in wouso/games/workshop/views.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return False, 'Player is cursed'
                  Severity: Major
                  Found in wouso/core/god/god.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return {'success': True}
                    Severity: Major
                    Found in wouso/games/challenge/api.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return {'success': False, 'error': 'Cannot refuse this challenge'}
                      Severity: Major
                      Found in wouso/games/challenge/api.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return {'success': False, 'error': 'Cannot cancel this challenge'}
                        Severity: Major
                        Found in wouso/games/challenge/api.py - About 30 mins to fix

                          Function mobile_browser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def mobile_browser(request):
                              if request.META.has_key("HTTP_USER_AGENT"):
                                  s = request.META["HTTP_USER_AGENT"].lower()
                                  for i in ('nokia', 'mobile'):
                                      if i in s:
                          Severity: Minor
                          Found in wouso/interface/__init__.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def main():
                              if len(sys.argv) != 2:
                                  print 'Usage: python add_users.py <file.csv>'
                                  print " CSV columns: username, first name, last name, email, password, cookie"
                                  sys.exit(1)
                          Severity: Minor
                          Found in wouso/utils/add_users_force.py - About 25 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def create(self, request):
                                  question = QotdGame.get_for_today()
                                  try:
                                      qotduser = request.user.get_profile().get_extension(QotdUser)
                                  except models.Model.DoesNotExist:
                          Severity: Minor
                          Found in wouso/games/qotd/api.py - About 25 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 set_profile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def set_profile(request):
                              user = request.user.get_profile()
                          
                              class SForm(forms.ModelForm):
                                  class Meta:
                          Severity: Minor
                          Found in wouso/interface/profile/views.py - About 25 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 get_challenge_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def get_challenge_time(arguments):
                              """
                               Return the number of seconds spent by the winner.
                              """
                              if not arguments:
                          Severity: Minor
                          Found in wouso/interface/activity/achievements.py - About 25 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 qpool_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def qpool_actions(request):
                              action = request.GET.get('action', None)
                              qs = request.GET.get('qs', '').split(',')
                              qs.remove('')
                              qs = map(int, qs)
                          Severity: Minor
                          Found in wouso/interface/cpanel/views.py - About 25 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 forum_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def forum_actions(request):
                              action = request.GET.get('action', None)
                              f_id = request.GET.get('f_id', '').split()
                              f_id = map(int, f_id)
                              queryset = Forum.objects.filter(id__in=f_id)
                          Severity: Minor
                          Found in wouso/interface/forum/cpanel_views.py - About 25 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 lesson_actions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def lesson_actions(request):
                              action = request.GET.get('action', None)
                              l_id = request.GET.get('l_id', '').split()
                              l_id = map(int, l_id)
                              queryset = Lesson.objects.filter(id__in=l_id)
                          Severity: Minor
                          Found in wouso/interface/apps/lesson/cpanel_views.py - About 25 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