Showing 53 of 82 total issues
Method collection_check_boxes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {})
Method select
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def select(method, choices = nil, options = {}, html_options = {}, &block)
Method select
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def select(method, values, options = {}, html_options = {}, &block)
Method email_present?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def email_present?
return unless (@current_step == 'email')
if @email.present?
errors.add(:email, 'Zadajte emailovú adresu v platnom tvare, napríklad jan.novak@firma.sk') unless @email.match?(URI::MailTo::EMAIL_REGEXP)
- 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 submit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def submit
return switch_account_callback unless eid_token&.valid? # If token expires meanwhile
if @upvs_submission.submit(eid_token)
if @upvs_submission.callback_url.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 load_municipality_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_municipality_options(data)
return [] unless data
if data&.with_missing_municipality_identifier?
@municipality_options = data&.address&.municipality_code_list.map{|m| m.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
Avoid too many return
statements within this method. Open
return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac')
Avoid too many return
statements within this method. Open
return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac')
Avoid too many return
statements within this method. Open
render :subject_selection and return
Avoid too many return
statements within this method. Open
render :stakeholder_identifier and return
Method current_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def current_user
if session[:user_id]
@__current_user ||= User.find_by(id: session[:user_id])
else
session[:anonymous_user_uuid] = SecureRandom.uuid unless session[:anonymous_user_uuid] # TODO make sure this is unique
- 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 invalid_date_errors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def invalid_date_errors(day_condition: false, month_condition: false, year_condition: false)
errors.add(:stakeholder_dob_day, nil) unless day_condition
errors.add(:stakeholder_dob_month, nil) unless month_condition
errors.add(:stakeholder_dob_year, nil) unless year_condition
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 set_date_of_birth
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_date_of_birth(year: nil, month: nil, day: nil)
@dob_day = day.present? ? day.to_i : nil
@dob_month = month.present? ? month.to_i : nil
@dob_year = year.present? ? year.to_i : nil
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"