Showing 333 of 1,278 total issues
Method expected_results
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expected_results(_event)
expected_races = []
race = Race.new(category: Category.new(name: "Category 3"))
Method team_standings_category_for
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def team_standings_category_for(result)
ages_begin = result["category_ages_begin"]
ages_begin = ::Categories::Ages::SENIOR.begin if ages_begin == 0
ages_end = result["category_ages_end"]
Method event
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def event
if params[:key]
year = params[:year] || RacingAssociation.current.effective_year
calculation = Calculations::V3::Calculation.find_by(key: params[:key], year: year)
Method update_people
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_people
expir_date = Date.new(Time.zone.today.year, 12, 31)
people_updated = []
@members_list.each do |memusac|
# get the parameters in a nice format
Method render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.render(column, row)
time = row[key(column)]
return nil if time.nil?
return time if time.is_a?(String) || time.is_a?(DateTime)
Method to_pdf
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_pdf(people, index = 0)
Array.wrap(people).each do |person|
start_new_page if index.positive? && (index % 15).zero?
card_top = bounds.top_left.last - ((index % 15) / 3) * 144
Method equivalent_category_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def equivalent_category_for(category_friendly_param, discipline)
return nil unless category_friendly_param && discipline
if discipline == Discipline[:overall]
event = self
- 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 effective_year
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def effective_year
if next_year_start_at && Time.zone.now < 1.year.from_now(next_year_start_at)
if Time.zone.now < next_year_start_at
return Time.zone.now.year
elsif Time.zone.now >= next_year_start_at
- 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_place
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_place(result, row)
if result.numeric_place?
result.place = result.numeric_place
if race?(row) && result.place != 1
import_warnings << "First racer #{row[:first_name]} #{row[:last_name]} should be first place racer. "
- 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 create_for_every!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.create_for_every!(days_of_week, params)
raise(ArgumentError) unless days_of_week && (params[:date] || params[:start_date]) && params[:end_date]
days_of_week = Array.wrap(days_of_week)
days_of_week.each do |day|
- 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 date_range_s
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def date_range_s(format = :short)
if format == :long
if start_date == end_date
date.strftime("%-m/%-d/%Y")
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 person
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def person
@person = Person.where(id: params[:person_id]).first
respond_to do |format|
format.html do
- 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
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def team
@team = Team.where(id: params[:team_id]).first
respond_to do |format|
format.html do
if @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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
@category = Category.find(params[:id])
@category.assign_attributes category_params
if @category.name_changed?
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(calculator)
return calculator.event_categories unless calculator.rules.place_by == "place"
calculator.event_categories.each do |category|
category.results
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(calculator)
calculator.event_categories.each do |category|
next if category.rejected?
place = 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 test_calculate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_calculate
category = Models::Category.new("Women")
rules = Rules.new(
category_rules: [Models::CategoryRule.new(category)],
weekday_events: false
Method categories_for
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def categories_for(race)
ids = [race.category] + race.category.descendants
case race.category.name
when "Senior Men Pro/1/2"
Function bindAutocompleteTeam
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindAutocompleteTeam() {
if (jQuery('.team_autocomplete').length) {
jQuery('.team_autocomplete').autocomplete({
delay: 200,
minLength: 3,
Method show
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
# Very explicit because we don't want to call something like 'eval' on a request parameter!
case params[:type]
when "rider_rankings"
competition_class = RiderRankings