Showing 231 of 446 total issues
Function handle_round
has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring. Open
def handle_round(self, round, **options):
panels = round.preformedpanel_set.all()
debates = round.debate_set.all()
allocator_class = registry[options["allocator"]]
- 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 13 (exceeds 8 allowed). Consider refactoring. Open
def get_queryset(self):
query_params = self.request.query_params
filters = Q()
# Disallow querying for feedback that they didn't submit
- 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_metric_columns
has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring. Open
def add_metric_columns(self, standings, integer_score_columns=[]):
"""`integer_score_columns`, if given, indicates which metrics to cast to
an int if the metric's value is an integer. For example, if the
tournament preferences are such that the total speaker score should
always be an integer, a list containing the string 'total' or
- 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 13 (exceeds 8 allowed). Consider refactoring. Open
def generate(cls, to: 'QuerySet[Person]', url: str, round: 'Round') -> List[Tuple[EmailContextData, 'Person']]:
emails = []
to_ids = {p.id for p in to}
draw = round.debate_set_with_prefetches(speakers=False).filter(debateadjudicator__adjudicator__in=to)
use_codes = use_team_code_names(round.tournament, 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
Consider simplifying this complex logical expression. Open
if show_splits and self.tournament.ballots_per_debate(debate.round.stage) == 'per-adj' \
and debate.confirmed_ballot \
and debate.confirmed_ballot.result.is_voting \
and debate.confirmed_ballot.result.is_valid() \
and (self.admin or self.tournament.pref('show_splitting_adjudicators')):
Function make_feedback_form_class_for_team
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_feedback_form_class_for_team(source, tournament, submission_fields, confirm_on_submit=False,
Function make_feedback_form_class_for_adj
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_feedback_form_class_for_adj(source, tournament, submission_fields, confirm_on_submit=False,
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 populate_result_with_scores
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def populate_result_with_scores(self, result):
for adj in self.adjudicators:
for side, pos in product(self.sides, self.positions):
score = self.cleaned_data[self._fieldname_score(adj, side, pos)]
for criterion in self.criteria:
- 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 _result_cell_two
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def _result_cell_two(self, ts, compress=False, show_score=False, show_ballots=False):
if not hasattr(ts, 'debate_team') or not hasattr(ts.debate_team.opponent, 'team'):
return {'text': self.BLANK_TEXT}
opp = ts.debate_team.opponent.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 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 get_context_data
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs):
team_codes = use_team_code_names(self.tournament, admin=self.for_admin, user=self.request.user)
kwargs["team_codes"] = json.dumps(team_codes)
- 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 _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_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 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 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 _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 process_view
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def process_view(self, request, view_func, view_args, view_kwargs):
if 'tournament_slug' in view_kwargs and request.path.split('/')[1] != 'api':
cached_key = "%s_%s" % (view_kwargs['tournament_slug'], 'object')
cached_tournament_object = cache.get(cached_key)
- 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"