Showing 551 of 2,707 total issues
Function setup_staff_groups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def setup_staff_groups():
for g in get_games():
for group in g.get_staff_and_permissions():
group_obj = Group.objects.get_or_create(name=group['name'])[0]
for p in group.get('permissions', []):
- 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 review_change
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def review_change(request, review):
review = get_object_or_404(Review, pk=review)
player = request.user.get_profile()
if review.reviewer != player:
- 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 give_modifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def give_modifier(self, modifier, amount=1):
""" Add given amount to existing, or create new artifact amount
for the current user.
Return the PlayerArtifactAmount object after applying changes.
- 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 _get_cache_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_cache_key(function, *args, **kwargs):
params = inspect.getargspec(function)[0]
cache_key = 'F-%s-' % function.__name__
for i, param_name in enumerate(params):
if i < len(args):
- 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 activity_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def activity_handler(cls, sender, **kwargs):
action = kwargs.get('action', None)
rules = filter(lambda x: x[2] == action, cls.SECURITY_RULES)
for rule in rules:
# check if rule is not disabled
- 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 play
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def play(request):
"""
Play current workshop or show expired message.
"""
player = request.user.get_profile()
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
self.stdout.write('Starting at: %s\n' % datetime.now())
# Now handle other apps
from wouso.interface.apps import get_apps
- 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 chall_was_set_up
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def chall_was_set_up(cls, **kwargs):
"""
Parse the chall-won activity message to
check the time it took for the loser to finish the challenge
"""
- 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 start_reviewing
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start_reviewing(cls, workshop):
""" Set the reviewers for all assessments in this workshop
"""
le_assessments = [a for a in list(workshop.assessment_set.filter(answered=True)) if not a.player.in_staff_group()]
shuffle(le_assessments)
- 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 history_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def history_for(user, game, external_id=None, formula=None, coin=None):
""" Return all history entries for given (user, game) pair.
"""
# TODO: check usage
fltr = {}
- 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 get_questions_with_tag_for_day
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_questions_with_tag_for_day(tag, select):
if isinstance(tag, str):
query = Question.objects.filter(tags__name=tag).exclude(endorsed_by__isnull=True)
for q in query:
if q.day == select:
- 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"