Showing 213 of 429 total issues
Function run_allocation
has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring. Open
def run_allocation(self):
# Sort voting adjudicators in descending order by score
voting = [a for a in self.adjudicators if a._weighted_score >= self.min_voting_score and not a.trainee]
random.shuffle(voting)
- 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
DebateResultByAdjudicator
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class DebateResultByAdjudicator(BaseDebateResult):
"""Base class for voting ballots.
Voting ballots have a DebateResult with one scoresheet per voting adjudicator.
This also provides access to the TeamScoreByAdj table.
Function import_debates
has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring. Open
def import_debates(self):
self.debates = {}
self.debateteams = {}
self.debateadjudicators = {}
- 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_speaker_columns
has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring. Open
def add_speaker_columns(self, speakers, categories=True):
speaker_data = []
for speaker in speakers:
anonymous = getattr(speaker, 'anonymise', False) or speaker.anonymous
if anonymous and not self.admin:
- 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 populate_results
has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring. Open
def populate_results(ballotsubs, tournament=None):
"""Populates the `_result` attribute of each BallotSubmission in
`ballotsubs` with a populated DebateResult instance.
For best performance, the ballot submissions should already have their
- 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 generate
has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring. Open
def generate(cls, to: 'QuerySet[Person]', debate: 'Debate') -> List[Tuple[EmailContextData, 'Person']]:
emails = []
tournament = debate.round.tournament
results = DebateResult(debate.confirmed_ballot)
round_name = _("%(tournament)s %(round)s @ %(room)s") % {'tournament': str(tournament),
- 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 views.py
has 670 lines of code (exceeds 600 allowed). Consider refactoring. Open
import csv
import json
import logging
import math
Function add_debate_results_columns
has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring. Open
def add_debate_results_columns(self, debates, iron=False):
all_sides_confirmed = all(debate.sides_confirmed for debate in debates) # should already be fetched
side_abbrs = {side: get_side_name(self.tournament, side, 'abbr')
for side in self.tournament.sides}
- 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 allocate_constrained_venues
has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring. Open
def allocate_constrained_venues(self, debate_constraints):
"""Allocates venues for debates that have one or more constraints on
them. `debate_constraints` should be
For each debate, it finds the set of venues that meet all its
- 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_two_team_generator
has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring. Open
def get_two_team_generator(draw_type, avoid_conflicts='australs', side_allocations=None, **kwargs):
if draw_type == "first_elimination":
return FirstEliminationDrawGenerator
elif draw_type == "elimination":
- 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 initial_data
has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring. Open
def initial_data(self):
"""Generates dictionary of initial form data."""
initial = {}
- 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_participants
has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring. Open
def add_participants(self):
participants_tag = SubElement(self.root, 'participants')
speaker_category_prefetch = Prefetch('speaker_set', queryset=Speaker.objects.all().prefetch_related('categories'))
for team in self.t.team_set.all().prefetch_related(speaker_category_prefetch, 'break_categories'):
- 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_debates
has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring. Open
def add_debates(self, round_tag, motion, debate):
debate_tag = SubElement(round_tag, 'debate', {
'id': DEBATE_PREFIX + str(debate.id),
})
- 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 _intermediate_brackets_with_bubble_up_down
has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring. Open
def _intermediate_brackets_with_bubble_up_down(self, brackets):
"""Operates in-place.
Requires Team.institution and Team.seen() to be defined."""
self._intermediate_brackets(brackets) # operates in-place
# Check each of the intermediate brackets for conflicts.
- 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 clean
has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring. Open
def clean(self):
super().clean()
section, first_pref = self.manager.parse_lookup(next(iter(self.cleaned_data.keys())))
t = self.manager.instance
- 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 _make_question_field
has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring. Open
def _make_question_field(self, question):
if question.answer_type == question.ANSWER_TYPE_BOOLEAN_SELECT:
field = BooleanSelectField()
elif question.answer_type == question.ANSWER_TYPE_BOOLEAN_CHECKBOX:
field = forms.BooleanField(required=False)
- 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
BaseDebateResult
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseDebateResult:
"""Base class for debate result.
The base class implements management of debate teams, side allocations and
team score saving.
Round
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Round(models.Model):
class DrawType(models.TextChoices):
RANDOM = 'R', _('Random')
MANUAL = 'M', _('Manual')
Function broadcast_checkin
has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring. Open
def broadcast_checkin(self, event):
content = event['content']
barcode_ids = [b for b in content['barcodes'] if b is not None]
return_content = {'created': content['status'], 'checkins': [],
'component_id': content['component_id']}
- 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
ConsensusDebateResult
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class ConsensusDebateResult(BaseDebateResult):
"""Consensus debate result without scores"""
def init_blank_buffer(self):
super().init_blank_buffer()