Showing 211 of 428 total issues
Function generate_pairings
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def generate_pairings(self, brackets):
"""Creates an undirected weighted graph for each bracket and gets the minimum weight matching"""
from .pairing import Pairing
pairings = OrderedDict()
i = 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
Function add_debate_venue_columns
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def add_debate_venue_columns(self, debates, with_times=True, for_admin=False):
def construct_venue_cell(venue):
if not venue:
return {'text': ''}
- 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 _print_result
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def _print_result(self):
if self.verbosity > 0:
counts = self.importer.counts
errors = self.importer.errors
if errors:
- 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_teams
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def import_teams(self):
self.teams = {}
for team in self.root.findall('participants/team'):
team_obj = Team(tournament=self.tournament, long_name=team.get('name'))
self.teams[team.get('id')] = team_obj
- 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 12 (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 validate
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def validate(self, data):
source = data.pop('source')
debate = data.pop('debate')
source_type = 'from_team' if isinstance(source, Team) else 'from_adj'
- 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 to_internal_value
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def to_internal_value(self, data):
"""
Dict of native values <- Dict of primitive datatypes.
Copied from DRF while waiting for #8001/#7671 as the format is nested
- 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 12 (exceeds 8 allowed). Consider refactoring. Open
def handle_tournament(self, tournament, **options):
def institution_name(inst):
if options['full_institution_name']:
return inst.name
- 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 12 (exceeds 8 allowed). Consider refactoring. Open
def clean(self):
cleaned_data = super().clean()
elim_fields = ['elim_' + category.slug for category in self.tournament.breakcategory_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 _get_breaking_teams_dict
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def _get_breaking_teams_dict(self):
if self.round.break_category is None:
self.error_type = 'no_break_category'
return {
'total': 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
Function _add_debate_standing_columns
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_debate_standing_columns(self, debates, standings, itermethod, infomethod, formattext, formatsort, limit=None):
Function _define_rooms_anywhere
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def _define_rooms_anywhere(points):
"""Defines rooms so that pull-up teams can go anywhere in the next
bracket up."""
counts = Counter(points)
rooms = []
- 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_speakers
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def add_speakers(self, side_tag, debate, result, side):
for pos in self.t.positions:
speaker = result.get_speaker(side, pos)
if speaker is not 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 add_ballot_check_in_columns
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def add_ballot_check_in_columns(self, debates, key):
status_header = {
'key': key,
'tooltip': _("Whether this debate's ballot has been checked in"),
- 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
Avoid deeply nested control flow statements. Open
for ballot in side.findall('ballot'):
for adj in [self.adjudicators.get(a) for a in ballot.get('adjudicators', "").split(" ")]:
if int(ballot.get('rank')) == 1:
dr.add_winner(adj, side_code)
dr.save()
Function liveness_twoteam
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def liveness_twoteam(is_general, current_round, break_size, total_teams, total_rounds, team_scores=[]):
Avoid deeply nested control flow statements. Open
if ('teams' in debate && debate.teams) {
for (const keyAndEntry of Object.entries(debate.teams)) {
let team = keyAndEntry[1]
// Team can be a number (ID) or null (e.g. when editing sides)
if (team !== null && typeof team === 'object' && 'break_categories' in team) {
Function add_result
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_result(debate, submitter_type, user, discarded=False, confirmed=False, reply_random=False):
Avoid deeply nested control flow statements. Open
if int(side.find('ballot').get('rank')) == 1:
dr.add_winner(side_code)
else:
Avoid deeply nested control flow statements. Open
if i == 0:
cell['class'] = 'highlight-col'
row.append(cell)