Showing 333 of 1,278 total issues
Function searchFor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function searchFor(type, objectName, method, selectText) {
if (!jQuery('#' + objectName + '_' + method + '_select_modal').is(':visible')) {
return;
}
Method test_stage_race
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_stage_race
category = Models::Category.new("Women")
rules = Rules.new(
category_rules: [Models::CategoryRule.new(category)],
weekday_events: false
Method parse
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(row)
logger.debug(row.inspect) if logger.debug?
row[:instructional] = true if row[:discipline] == "Clinic"
Method test_maximum_events_by_category
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_maximum_events_by_category
women = Models::Category.new("Women")
women_4 = Models::Category.new("Women 4")
series = Models::Event.new(id: 0, date: Date.new(2018, 5, 1), end_date: Date.new(2018, 5, 15))
Method category_names
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def category_names
if year < 2016
[
"Beginner Men",
"Beginner Women",
Method test_highest_result_breaks_three_way_tie_2
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_highest_result_breaks_three_way_tie_2
source_results = [
result(points: 38, participant_id: 1, scores: [
{ numeric_place: 3, date: Date.new(2012, 9, 17) },
{ numeric_place: 2, date: Date.new(2012, 9, 24) },
Method team_standings_category_for
has a Cognitive Complexity of 14 (exceeds 5 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"]
- 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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.find(params)
query = if RacingAssociation.current.include_multiday_events_on_schedule?
Event.where(parent_id: nil).where.not(type: "Event")
else
Event.where(type: "SingleDayEvent")
- 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_all_by_name_or_alias
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.find_all_by_name_or_alias(*args)
options = args.extract_options!
options.each_key { |key| raise(ArgumentError, "'#{key}' is not a valid key") unless %i[name first_name last_name].include?(key) }
name = args.join(" ") if options.empty?
- 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_highest_result_breaks_three_way_tie
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_highest_result_breaks_three_way_tie
source_results = [
result(points: 62, participant_id: 1, scores: [
{ numeric_place: 6, date: Date.new(2012, 10, 2) },
{ numeric_place: 2, date: Date.new(2012, 10, 19) },
Function bindAutocomplete
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindAutocomplete() {
if (jQuery('.autocomplete').length) {
jQuery('.autocomplete').autocomplete({
delay: 200,
minLength: 3,
Method categories_for
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def categories_for(race)
categories = super(race)
if year < 2016
categories << Category.find_or_create_by(name: "Masters Men A 40+") if race.name == "Masters 35+ A"
Method test_apply_team_sizes_not_team_event_small_event
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_apply_team_sizes_not_team_event_small_event
expected = [
result(place: 1, race_id: 1, team_size: 3, participant_id: 1, field_size: 3),
result(place: 1, race_id: 1, team_size: 3, participant_id: 2, field_size: 3),
result(place: 1, race_id: 1, team_size: 3, participant_id: 3, field_size: 3)
Method add_upgrade_results
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_upgrade_results(results, race)
if race.name.in?(upgrades.keys)
upgrade_categories = Array.wrap(upgrades[race.name])
upgrade_races = races.select { |r| r.name.in?(upgrade_categories) }
results.to_a + Result.connection.select_all(Result
Method render_header
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.render_header(column)
case key(column)
when :bar
"BAR"
when :category_name
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 merge
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def merge(team)
raise(ArgumentError, "Cannot merge nil team") unless team
return false if team == self
Team.transaction 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 add_number
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_number(value, discipline, issuer = nil, _year = year)
return false if discipline.blank? && value.blank?
mapped_discipline = if discipline.nil? || !discipline.numbers?
Discipline[:road]
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(calculator)
return calculator.event_categories if calculator.rules.source_event_keys.any?
calculator.unrejected_source_results.each do |source_result|
next unless source_result.event.calculated?
- 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 best_match_by_age_in
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def best_match_by_age_in(event_categories, result_age = nil)
debug "Category#best_match_by_age_in for #{name}, #{result_age} in #{event_categories.map(&:name).join(', ')}"
candidate_categories = event_categories.dup
- 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"