Apply StringConcatenation rule in some places

This rule was added in Rubocop 0.89.0. However, there are some false
positives when we don't use interpolation but simply concatenate in
order to avoid long lines. Even if there weren't false positives, there
are places where we concatenate to emphasize the point that we're adding
a certain character to a text.

We might reconsider this rule in the future, since we generally prefer
interpolation over concatenation.
This commit is contained in:
Javi Martín
2020-10-10 22:00:55 +02:00
parent efd8f47596
commit 66759d2dc0
8 changed files with 9 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ module FollowablesHelper
return unless follow.followable.present? return unless follow.followable.present?
followable = follow.followable followable = follow.followable
partial = followable_class_name(followable) + "_follow" partial = "#{followable_class_name(followable)}_follow"
locals = { followable_class_name(followable).to_sym => followable } locals = { followable_class_name(followable).to_sym => followable }
render partial, locals render partial, locals

View File

@@ -3,7 +3,7 @@ module TracksHelper
track_data = "" track_data = ""
prefix = " data-track-event-" prefix = " data-track-event-"
data.each do |key, value| data.each do |key, value|
track_data = track_data + prefix + key.to_s + "=" + value + " " track_data = "#{track_data}#{prefix}#{key}=#{value} "
end end
content_for :track_event do content_for :track_event do
track_data track_data

View File

@@ -21,6 +21,6 @@ module VerificationHelper
data_to_mask = match[2] data_to_mask = match[2]
email_provider = match[3] email_provider = match[3]
data_to_display + "*" * data_to_mask.size + "@" + email_provider "#{data_to_display}#{"*" * data_to_mask.size}@#{email_provider}"
end end
end end

View File

@@ -7,9 +7,9 @@ module VotesHelper
return "0%" if debate.total_votes == 0 return "0%" if debate.total_votes == 0
if vote == "likes" if vote == "likes"
debate_percentage_of_likes(debate).to_s + "%" "#{debate_percentage_of_likes(debate)}%"
elsif vote == "dislikes" elsif vote == "dislikes"
(100 - debate_percentage_of_likes(debate)).to_s + "%" "#{100 - debate_percentage_of_likes(debate)}%"
end end
end end

View File

@@ -7,7 +7,7 @@ section "Creating Admin Notifications & Templates" do
"people will discuss & support it.", "people will discuss & support it.",
body_es: "Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.", body_es: "Recuerda que puedes crear propuestas y los ciudadanos las debatirán y apoyarán.",
link: Setting["url"] + "/proposals", link: "#{Setting["url"]}/proposals",
segment_recipient: "administrators" segment_recipient: "administrators"
).deliver ).deliver

View File

@@ -22,7 +22,7 @@ describe "Homepage" do
scenario "Admin menu links to homepage path" do scenario "Admin menu links to homepage path" do
visit new_admin_widget_card_path(header_card: true) visit new_admin_widget_card_path(header_card: true)
click_link Setting["org_name"] + " Administration" click_link "#{Setting["org_name"]} Administration"
expect(page).to have_current_path(admin_root_path) expect(page).to have_current_path(admin_root_path)
end end

View File

@@ -58,7 +58,7 @@ describe "Documents" do
scenario "Create" do scenario "Create" do
visit new_admin_site_customization_document_path visit new_admin_site_customization_document_path
attach_file("document_attachment", Rails.root + "spec/fixtures/files/logo.pdf") attach_file("document_attachment", "#{Rails.root}/spec/fixtures/files/logo.pdf")
click_button "Upload" click_button "Upload"
expect(page).to have_content "Document uploaded succesfully" expect(page).to have_content "Document uploaded succesfully"

View File

@@ -33,8 +33,7 @@ describe "Social media meta tags" do
expect(page).to have_property "og:title", with: meta_title expect(page).to have_property "og:title", with: meta_title
expect(page).to have_property "article:publisher", with: url expect(page).to have_property "article:publisher", with: url
expect(page).to have_property "article:author", with: "https://www.facebook.com/" + expect(page).to have_property "article:author", with: "https://www.facebook.com/#{facebook_handle}"
facebook_handle
expect(page).to have_property "og:url", with: "#{Capybara.app_host}/" expect(page).to have_property "og:url", with: "#{Capybara.app_host}/"
expect(page).to have_property "og:image", with: "#{Capybara.app_host}/social_media_icon.png" expect(page).to have_property "og:image", with: "#{Capybara.app_host}/social_media_icon.png"
expect(page).to have_property "og:site_name", with: org_name expect(page).to have_property "og:site_name", with: org_name