Method validate_standard_result
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def validate_standard_result
if all_stats_submitted?
errors.add(:base, 'Ranks are invalid') unless valid_ranks?
errors.add(:base, 'Speaks are invalid') unless valid_speaks?
errors.add(:base, 'Speaks/Ranks are out of order') unless valid_speaks_ranks_order?
Method <=>
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def <=>(other)
if had_rounds? && other.had_rounds?
return other.stats.wins - stats.wins unless stats.wins == other.stats.wins
super(other)
elsif !had_rounds? && !other.had_rounds?
Method policy_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def self.policy_for(debater, round)
if round.bye? || round.all_win?
AverageStatsPolicy.new debater, round
elsif round.forfeit? || round.all_drop?
klass = round.winner?(debater.team) ? AverageStatsPolicy : self.forfeit_policy
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
render() {
return(
<div className="debater_form">
<form id="debater" onSubmit={this.handleSubmit}>
<FormGroup controlId="name">
Method <=>
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def <=>(other)
RANKING_PRIORITY.each do |attr|
difference = other.stats.send(attr) - stats.send(attr)
next if difference.zero?
return attr.include?('ranks') ? -1 * difference : difference