Showing 231 of 446 total issues
Function clean_scores_raw
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
def clean_scores_raw(self):
lines = self.cleaned_data['scores_raw'].split('\n')
errors = []
records = []
- 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_debate_adjs
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
def allocate_debate_adjs(self, event):
round = Round.objects.get(pk=event['extra']['round_id'])
self._apply_allocation_settings(round, event['extra']['settings'])
if round.draw_status == round.Status.RELEASED:
- 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 venue_conflicts_display
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
def venue_conflicts_display(debates):
"""Returns a dict mapping elements (debates) in `debates` to a list of
strings of explaining unfulfilled venue constraints for participants that
debate. A venue constraint (or more precisely, a set of venue constraints
relating to a single participant) is "unfulfilled" if the relevant
- 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 create
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
def create(self, validated_data):
result_data = validated_data.pop('result').pop('get_result_info')
veto_data = validated_data.pop('debateteammotionpreference_set', None)
validated_data.update(self.get_submitter_fields())
- 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_from_merge
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def populate_from_merge(self, *results) -> list[ResultError]:
errors = []
for result in results:
errors.extend(self.merge_speaker_result(result))
if self.scoresheet_class.uses_declared_winners:
- 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_content_object_display
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def get_content_object_display(self, omit_tournament=False, user=None):
obj = self.content_object
if obj is None:
return None
- 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_tournament
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def handle_tournament(self, tournament, **options):
for adj in tournament.adjudicator_set.all():
seen = list()
for feedback in adj.adjudicatorfeedback_set.all():
- 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_feedback_form_class_for_team
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def make_feedback_form_class_for_team(source, tournament, submission_fields, confirm_on_submit=False,
enforce_required=True, include_unreleased_draws=False,
use_tournament_password=False, ignored_option=False):
"""Constructs a FeedbackForm class specific to the given source team.
Parameters are as for make_feedback_form_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 _pullup
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def _pullup(self, brackets, indices):
"""'brackets' is what is returned by _make_raw_brackets().
'pos' is a function taking the number of teams to choose from
and number of teams required, and returning a list of indices
for which teams to take as the pullup.
- 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_result_class
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def get_result_class(ballotsub, round=None, tournament=None):
if round is None:
round = ballotsub.round
if tournament is None:
tournament = round.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
Function adjudicator_conflicts_display
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def adjudicator_conflicts_display(debates):
"""Returns a dict mapping elements (debates) in `debates` to a list of
strings of explaining conflicts between adjudicators and teams, and
conflicts between adjudicators and each other."""
- 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 17 (exceeds 8 allowed). Consider refactoring. Open
def generate(cls, to: 'QuerySet[Person]', round: 'Round') -> List[Tuple[EmailContextData, 'Person']]:
emails = []
to_ids = {p.id for p in to}
tournament = round.tournament
draw = round.debate_set_with_prefetches(speakers=True).filter(debateteam__team__speaker__in=to)
- 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 setSorting
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
setSorting (state, sortType) {
let debatesArray = Object.values(state.debatesOrPanels)
if (debatesArray.length === 0) {
return // e.g. Preformed Panels page prior to use
Function debate_set_with_prefetches
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def debate_set_with_prefetches(self, filter_args=[], filter_kwargs={}, ordering=(F('venue__name').asc(nulls_last=True),),
Function fill_scoresheet_randomly
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def fill_scoresheet_randomly(scoresheet, tournament, nattempts=1000):
"""Fills a scoresheet randomly. Operates in-place. Bails if it can't
generate a valid scoresheet within 1000 attempts."""
for attempt in range(nattempts):
- 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_adjudicators
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def import_adjudicators(self, f, auto_conflict=True):
"""Imports adjudicators. Institutions are not created as needed; if an
institution doesn't exist, an error is raised. Conflicts are created
from the same file, if present. If 'auto_conflict' is True (default),
conflicts are created with adjudicators' own institutions.
- 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_tournament
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def handle_tournament(self, tournament, **options):
def institution_name(inst):
if not inst:
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 populate_database
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def populate_database(self):
"""Populates the database with BreakingTeam instances for each team
representing in `self.breaking_teams`, and those teams in
`self.excluded_teams` that ranked ahead of the last breaking team."""
- 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 debate_set_with_prefetches
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def debate_set_with_prefetches(self, filter_args=[], filter_kwargs={}, ordering=(F('venue__name').asc(nulls_last=True),),
teams=True, adjudicators=True, speakers=True, wins=False,
results=False, venues=True, institutions=False, check_ins=False, iron=False):
"""Returns the debate set, with aff_team and neg_team populated.
This is basically a prefetch-like operation, except that it also figures
- 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_feedback_progress_columns
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def add_feedback_progress_columns(self, progress_list, key="P"):
def _owed_cell(progress):
owed = progress.num_unsubmitted()
cell = {
'text': owed,
- 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"