Class Result
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Result < ApplicationRecord
UNPLACED = 999_999
before_save :set_associated_records
Method set_team
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_team
if team&.new_record?
team.updater = event
if team.name.blank?
self.team = nil
- 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
Method every_person_is_a_member?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def every_person_is_a_member?
return true if RacingAssociation.current.exempt_team_categories.nil? || RacingAssociation.current.exempt_team_categories.include?(race.category.name)
Result.where(race_id: race_id, place: place).where.not(id: id).find_each do |result|
next unless result.person_id && !result.person.member?(date)
- 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
Method last_event?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def last_event?
return false unless event&.parent
return false unless event.parent.respond_to?(:parent)
return true unless event.parent
- 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
TODO found Open
# TODO rationalize names
- Exclude checks