Function student_row
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def student_row(levels_sorted, student, best_attempts):
threshold = 0.5
num_all = num_finished = num_attempted = num_started = 0
total_score = 0
- 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
File scoreboard.py
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
from __future__ import absolute_import
from __future__ import division
from builtins import map
from builtins import next
Function scoreboard
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def scoreboard(request):
"""
Renders a page with students' scores. A teacher can see the visible classes in
their school. Student's view is restricted to their class if their teacher enabled
the scoreboard for said class.
- 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 _check_attempts
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_attempts(best_attempts):
threshold = 0.5
# episode ids with low attempts (below 50%)
low_episode_ids = set()
- 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 scoreboard_view
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def scoreboard_view(
Avoid deeply nested control flow statements. Open
if not attempt.level.disable_algorithm_score:
max_score += 10
if int(attempt.level.name) < 13:
Avoid deeply nested control flow statements. Open
if int(attempt.level.name) < 13:
max_score = 20
Avoid deeply nested control flow statements. Open
if not attempt.level.disable_route_score:
max_score += 10
if not attempt.level.disable_algorithm_score:
Avoid deeply nested control flow statements. Open
if attempt.score / max_score >= threshold:
num_finished += 1
else:
num_attempted += 1
else:
Avoid too many return
statements within this function. Open
return scoreboard_view(