rosedu/wouso

View on GitHub

Showing 551 of 2,707 total issues

Function try_using_cookie_no_recurse has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def try_using_cookie_no_recurse(username, first_name, last_name, email, password, cookie):
Severity: Minor
Found in wouso/utils/add_users_force_to_race.py - About 45 mins to fix

    Function try_using_truncate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def try_using_truncate(username, first_name, last_name, email, password, cookie):
    Severity: Minor
    Found in wouso/utils/add_users_force_to_race.py - About 45 mins to fix

      Function add_user_no_matter_what has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def add_user_no_matter_what(username, first_name, last_name, email, password, cookie):
      Severity: Minor
      Found in wouso/utils/add_users_force.py - About 45 mins to fix

        Function import_questions_from_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def import_questions_from_file(f, proposed_by=None, endorsed_by=None, category=None, tag=None, active=False):
        Severity: Minor
        Found in wouso/utils/add_questions.py - About 45 mins to fix

          Function add_question has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_question(question):
              """ question is a dictionary with the following keys:
                  'text': the question text (string)
                  'answer_type': whether the question is single choice or multiple choice (string)
                  'answers': a dictionary of answers with the following keys:
          Severity: Minor
          Found in wouso/utils/add_questions.py - About 45 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 sidebar_widget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def sidebar_widget(context):
              # TODO: nothing should happen in the sidebar_widget
              user = context.get('user', None)
              if not user or not user.is_authenticated():
                  return ''
          Severity: Minor
          Found in wouso/games/qotd/views.py - About 45 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 try_using_cookie_no_recurse has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def try_using_cookie_no_recurse(username, first_name, last_name, email, password, cookie):
          Severity: Minor
          Found in wouso/utils/add_users_force.py - About 45 mins to fix

            Function main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            def main():
                if len(sys.argv) != 2:
                    print 'Usage: python remove_users.py <input-file>'
                    print " Input file contains usernames, one per line."
                    sys.exit(1)
            Severity: Minor
            Found in wouso/utils/remove_users.py - About 45 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 try_using_cookie has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def try_using_cookie(username, first_name, last_name, email, password, cookie):
            Severity: Minor
            Found in wouso/utils/add_users_force_to_race.py - About 45 mins to fix

              Function try_using_truncate has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def try_using_truncate(username, first_name, last_name, email, password, cookie):
              Severity: Minor
              Found in wouso/utils/add_users_force.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if karma_points == 0:
                                        continue
                
                                    # Compute formula and calculate amount of bonus given
                                    amount = eval(formula.expression.format(**{'karma_points': karma_points}).split('=')[1])
                Severity: Major
                Found in wouso/interface/cpanel/views.py - About 45 mins to fix

                  Function update_user has a Cognitive Complexity of 8 (exceeds 5 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):
                      """Update user by username. Return True if successful. Return False if user
                      does not exist.
                      """
                      user = User.objects.get(username=username)
                  Severity: Minor
                  Found in wouso/utils/user_util.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                      for chunk in image.chunks():
                                          fout.write(chunk)
                              instance = form.save()
                  Severity: Major
                  Found in wouso/interface/cpanel/views.py - About 45 mins to fix

                    Function import_from_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def import_from_file(opened_file, proposed_by=None, endorsed_by=None, category=None, tags=None, all_active=False):
                    Severity: Minor
                    Found in wouso/utils/import_questions.py - About 45 mins to fix

                      Function try_using_cookie has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def try_using_cookie(username, first_name, last_name, email, password, cookie):
                      Severity: Minor
                      Found in wouso/utils/add_users_force.py - About 45 mins to fix

                        Function extraInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def extraInfo(self, user_won, user_lost):
                                '''returns a string with extra info for a string such as User 1 finished the challenge in $SECONDS seconds
                                (or $MINUTES minutes and seconds) and scored X points)'''
                        
                                def formatTime(seconds):
                        Severity: Minor
                        Found in wouso/games/challenge/models.py - About 45 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 score has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def score(user, game, formula, external_id=None, percents=100, **params):
                        Severity: Minor
                        Found in wouso/core/scoring/sm.py - About 45 mins to fix

                          Function player has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def player(user, artif_html=None, real_name=False):
                              """ Render player name and level image with link to player's profile """
                              if not user or isinstance(user, str):
                                  return ''
                          
                          
                          Severity: Minor
                          Found in wouso/core/user/templatetags/user.py - About 45 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 sidebar_widget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def sidebar_widget(context):
                              user = context.get('user', None)
                              quest = QuestGame.get_current()
                          
                              if quest is None or user is None or not user.is_authenticated():
                          Severity: Minor
                          Found in wouso/games/quest/views.py - About 45 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 post_cast has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def post_cast(sender, **kwargs):
                              """ Execute action after a spell is cast. This is used to implement specific spells
                              such as 'clean any existing spell' cast.
                          
                              Returns True if action has been taken, False if not.
                          Severity: Minor
                          Found in wouso/core/god/god.py - About 45 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