Showing 333 of 1,278 total issues
Method points_for_place
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.points_for_place(source_result, points_for_place, place_by, result_place, results_size)
Method build_number
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_number(value, discipline, issuer, updater, year)
Method create_number
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_number(value, discipline, issuer, updater, year)
Method build_result
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_result(race, place, first_name = nil, last_name = nil, team_name = nil)
Method assert_renew
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def assert_renew(now, member_from, member_to, expected_member_from, expected_member_to)
Method create_if_best_result_for_race
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_if_best_result_for_race(attributes)
source_result = attributes[:source_result]
scores = proxy_association.owner.scores
scores.each do |score|
- 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 result?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def result?(row)
return false unless row
return true if row[:place].present? || row[:number].present? || row[:license].present? || row[:team_name].present?
return true unless row[:first_name].blank? && row[:last_name].blank? && row[:name].blank?
- 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 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 after_create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def after_create(name)
case name.nameable
when Person
name.nameable.results.each do |result|
result.cache_attributes! :non_event if result[:name] != name.nameable.name(result.year)
- 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 previous_year
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def previous_year
exact_match = Event.find_by(name: name, year: year - 1)
return exact_match if exact_match
diff, event = previous_best_match
- 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 time_to_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def time_to_s(time)
return "" if time == 0.0 || time.blank?
positive = time >= 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
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
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
Method assert_columns!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assert_columns!(table)
keys = table.columns.map(&:key)
import_warnings << "No place column. Place is required." unless keys.include?(:place)
unless keys.include?(:name) || (keys.include?(:first_name) && keys.include?(:lastname)) || keys.include?(:team_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
Method calculate!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(year = Time.zone.today.year)
ActiveSupport::Notifications.instrument "calculate.#{name}.competitions.racing_on_rails" do
transaction do
year = year.to_i if year.is_a?(String)
competition = find_or_create_for_year(year)
- 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 require_same_person_or_administrator_or_editor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def require_same_person_or_administrator_or_editor
return false unless require_current_person
unless administrator? || (@person && current_person == @person) || @person&.editors&.include?(current_person)
redirect_to unauthorized_path
- 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 dates_are_same_year
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def dates_are_same_year
errors.add(:date, "must be in year #{year}, but is #{date.year}") unless year == date.year
errors.add(:end_date, "must be in year #{year}, but is #{end_date.year}") unless year == end_date.year
if event && year != event.year
- 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 <=>
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
if rejected? && !other.rejected?
return 1
elsif !rejected? && other.rejected?
return -1
- 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 calculate!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(calculator)
return calculator.event_categories if calculator.rules.weekday_events?
calculator.unrejected_source_results.each do |source_result|
next if !weekday?(source_result.event) ||
- 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"