Apply Style/RedundantReturn rubocop rule

We were already following this pattern most of the time.
This commit is contained in:
Javi Martín
2019-10-26 13:26:35 +02:00
parent ddb37f89ae
commit 8e3bfa0d72
8 changed files with 13 additions and 10 deletions

View File

@@ -409,6 +409,9 @@ Style/Proc:
Style/RedundantFreeze: Style/RedundantFreeze:
Enabled: true Enabled: true
Style/RedundantReturn:
Enabled: true
Style/SafeNavigation: Style/SafeNavigation:
Enabled: true Enabled: true

View File

@@ -26,7 +26,7 @@ module SignatureSheetsHelper
text_help += tag(:br) text_help += tag(:br)
text_help += t("admin.signature_sheets.new.text_help.required_fields_structure_note") text_help += t("admin.signature_sheets.new.text_help.required_fields_structure_note")
return text_help text_help
end end
def example_text_help def example_text_help
@@ -45,6 +45,6 @@ module SignatureSheetsHelper
end end
text_example += "#{example_1}; #{example_2}" text_example += "#{example_1}; #{example_2}"
return text_example text_example
end end
end end

View File

@@ -165,6 +165,6 @@ class Debate < ApplicationRecord
def self.debates_orders(user) def self.debates_orders(user)
orders = %w[hot_score confidence_score created_at relevance] orders = %w[hot_score confidence_score created_at relevance]
orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates orders << "recommendations" if Setting["feature.user.recommendations_on_debates"] && user&.recommended_debates
return orders orders
end end
end end

View File

@@ -40,7 +40,7 @@ class I18nContent < ApplicationRecord
return output.update({ path => input }) unless input.is_a? Hash return output.update({ path => input }) unless input.is_a? Hash
input.map { |key, value| flat_hash(value, [path, key].compact.join("."), output) } input.map { |key, value| flat_hash(value, [path, key].compact.join("."), output) }
return output output
end end
def self.content_for(tab) def self.content_for(tab)

View File

@@ -243,7 +243,7 @@ class Proposal < ApplicationRecord
def self.proposals_orders(user) def self.proposals_orders(user)
orders = %w[hot_score confidence_score created_at relevance archival_date] orders = %w[hot_score confidence_score created_at relevance archival_date]
orders << "recommendations" if Setting["feature.user.recommendations_on_proposals"] && user&.recommended_proposals orders << "recommendations" if Setting["feature.user.recommendations_on_proposals"] && user&.recommended_proposals
return orders orders
end end
def skip_user_verification? def skip_user_verification?

View File

@@ -52,11 +52,11 @@ class SignatureSheet < ApplicationRecord
def parse_postal_code(required_fields_to_verify) def parse_postal_code(required_fields_to_verify)
if Setting.force_presence_date_of_birth? && Setting.force_presence_postal_code? if Setting.force_presence_date_of_birth? && Setting.force_presence_postal_code?
return required_fields_to_verify[2] required_fields_to_verify[2]
elsif Setting.force_presence_postal_code? elsif Setting.force_presence_postal_code?
return required_fields_to_verify[1] required_fields_to_verify[1]
else else
return nil nil
end end
end end
end end

View File

@@ -308,7 +308,7 @@ def documentable_redirected_to_resource_show_or_navigate_to
find("a", text: "Not now, go to my proposal") find("a", text: "Not now, go to my proposal")
click_on "Not now, go to my proposal" click_on "Not now, go to my proposal"
rescue rescue
return nil
end end
def documentable_attach_new_file(path, success = true) def documentable_attach_new_file(path, success = true)

View File

@@ -254,7 +254,7 @@ def imageable_redirected_to_resource_show_or_navigate_to
find("a", text: "Not now, go to my proposal") find("a", text: "Not now, go to my proposal")
click_on "Not now, go to my proposal" click_on "Not now, go to my proposal"
rescue rescue
return nil
end end
def imageable_attach_new_file(_imageable_factory_name, path, success = true) def imageable_attach_new_file(_imageable_factory_name, path, success = true)