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):
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):
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):
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):
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:
- Read upRead up
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 ''
- Read upRead up
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):
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)
- Read upRead up
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):
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):
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])
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)
- Read upRead up
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()
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):
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):
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):
- Read upRead up
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):
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 ''
- Read upRead up
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():
- Read upRead up
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.
- Read upRead up
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"