Showing 333 of 1,278 total issues
Method render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.render(column, row)
result = row.source
text = row[column.key]
return text unless result.team_id
- 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 import
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def import
case params[:commit]
when "Cancel"
session[:people_file_path] = nil
redirect_to(action: "index")
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def require_same_person_or_administrator
return false unless require_current_person
unless administrator? || (@person && current_person == @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 labelled_select
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def labelled_select(method, choices, options = {}, html_options = { class: "form-control" })
label_options = options.delete(:label) || { class: "control-label col-sm-4" }
text = label_options.delete(:text) if label_options
if options[:editable] == false
%(#{label(method, (text || method.to_s.titleize).to_s, label_options)} <div id="#{object_name}_#{method}">#{@object.send(method)}</div>).html_safe
- 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 replace_roman_numeral_categories
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.replace_roman_numeral_categories(name)
if name
name = name.split.map do |token|
case token
when "I"
- 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 number
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def number(discipline_param, reload = false, year = nil)
return nil if discipline_param.nil?
year ||= RacingAssociation.current.year
discipline_param = discipline_param.to_param if discipline_param.is_a?(Discipline)
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate!(calculator)
if calculator.rules.members_only?
calculator.unrejected_results.each do |result|
if calculator.year == 2021
result.participant.id.in?(TEAMS_2021)
- 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 show
has a Cognitive Complexity of 6 (exceeds 5 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
- 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 split_camelcase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.split_camelcase(name)
return name if name.nil?
unless name.downcase == name || name.upcase == name
name = name.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1 \2')
- 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 membership_dates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def membership_dates
errors.add("member_from", "cannot be nil if member_to is not nil (#{member_to})") if member_to && !member_from
errors.add("member_to", "cannot be nil if member_from is not nil (#{member_from})") if member_from && !member_to
- 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 racer_days_by_discipline
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.racer_days_by_discipline(years)
chart_data = Discipline.all.map { |discipline| { name: discipline.name, data: [] } }
years.each do |year|
res = Result.joins(:event).where(events: { year: year, type: "SingleDayEvent" })
.where(competition_result: false, team_competition_result: false)
- 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 events_for_api
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def events_for_api(year)
name = params[:name].try(:strip)
year = RacingAssociation.current.effective_year.to_i if year.blank?
if name.present?
- 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 racers_by_discipline
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.racers_by_discipline(years)
chart_data = Discipline.all.map { |discipline| { name: discipline.name, data: [] } }
years.each do |year|
res = Result.joins(:event).where(events: { year: year, type: "SingleDayEvent" })
.where(competition_result: false, team_competition_result: false)
- 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"