Showing 231 of 446 total issues
Function get_result_display
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def get_result_display(self):
if self.team.tournament.pref('teams_in_debate') == 4:
if self.points is not None:
return gettext("placed %(place)s") % {'place': ordinal(4 - self.points)}
else:
- 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_table
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def get_table(cls, view, participant):
"""On team record pages, the table is the results table."""
table = TeamResultTableBuilder(view=view, title=view.table_title, sort_key="round")
- 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 add_debate_side_history_columns
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def add_debate_side_history_columns(self, debates, round):
# Teams should be prefetched in debates, so don't use a new Team queryset to collate teams
def get_team_or_none(debate: 'Debate', side: int) -> Optional['Team']:
try:
- 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 side_and_position_names
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def side_and_position_names(tournament):
"""Yields 2-tuples (side, positions), where position is a list of position
names, all being translated human-readable names. This should eventually
be extended to return an appropriate list for the tournament configuration.
"""
- 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 import_motions
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def import_motions(self):
# Can cause data consistency problems if motions are re-used between rounds: See #645
self.motions = {}
motions_by_round = {}
- 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_context_data
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs):
t = self.tournament
updates = 10 # Number of items to fetch
kwargs["round"] = t.current_round
- 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 _fetch_conflicts_from_db
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def _fetch_conflicts_from_db(self):
"""Fetches relevant conflicts from the database, based on `self.teams`
and `self.adjudicators`."""
# Refresh `self.adjudicator_ids` and `self.team_ids`
- 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 form_valid
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def form_valid(self, form: TestEmailForm) -> 'HttpResponseRedirect':
host = self.request.get_host()
try:
recipient = form.send_email(host)
- 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_queryset
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def get_queryset(self):
qs = super().get_queryset().prefetch_related(Prefetch('team__debateteam_set', queryset=DebateTeam.objects.all().select_related('debate__round__tournament')))
data = {s.id: s for s in qs.all()}
speaker_scores = SpeakerScore.objects.select_related('speaker', 'ballot_submission',
- 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 setUp
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def setUp(self):
super().setUp()
# add test models
self.tournament = Tournament.objects.create(slug="tournament")
for i in range(4):
- 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 annotate
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def annotate(self, queryset, standings, round=None):
if not queryset.exists():
return
logger.info("Running opponents query for draw strength:")
- 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"