Class Person
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Person < ApplicationRecord
LOGIN_FORMAT = /\A\w[\w.+\-_@ ]+\z/.freeze
include Comparable
include Export::People
File person.rb
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "sentient_user/sentient_user"
# Someone who either appears in race results or who is added as a member of a racing association
#
# Names are _not_ unique. In fact, there are many business rules about names. See Aliases and Names.
Method lic_check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.lic_check(lic, lic_date)
if lic_date && lic.to_i > 0
case lic_date
when Date, Time, DateTime
lic_date > Time.zone.today ? "current" : "CHECK LIC!"
- 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 team_name=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def team_name=(value)
if value.blank? || value == "N/A"
self.team = nil
else
self.team = Team.find_by_name_or_alias(value)
- 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 hometown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def hometown
if city.blank?
if state.blank?
""
elsif state == RacingAssociation.current.state
- 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 find_associated_records
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_associated_records
if team&.new_record?
if team.name.blank? || (team.name == "N/A")
self.team = nil
else
- 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 city_state_zip
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def city_state_zip
if city.present?
if state.present?
"#{city}, #{state} #{zip}"
else
- 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: Any reason not to change this to last name, first name?
- Exclude checks