Add and apply Style/RedundantInterpolation rule

Somehow I thought we already had this rule; must have forgotten to
actually add it.
This commit is contained in:
Javi Martín
2021-08-09 19:26:32 +02:00
parent 99bbad9b1e
commit 469b39ffa3
9 changed files with 21 additions and 18 deletions

View File

@@ -464,6 +464,9 @@ Style/RedundantFileExtensionInRequire:
Style/RedundantFreeze:
Enabled: true
Style/RedundantInterpolation:
Enabled: true
Style/RedundantReturn:
Enabled: true

View File

@@ -4,7 +4,7 @@ module MilestonesHelper
tag.div class: "progress",
role: "progressbar",
"aria-valuenow": "#{progress_bar.percentage}",
"aria-valuenow": progress_bar.percentage,
"aria-valuetext": "#{progress_bar.percentage}%",
"aria-valuemax": ProgressBar::RANGE.max,
"aria-valuemin": "0",

View File

@@ -9,7 +9,7 @@ module I18n
return entry unless entry.is_a?(Hash) && count
key = pluralization_key(entry, count)
return "#{count}" unless entry.has_key?(key)
return count.to_s unless entry.has_key?(key)
entry[key]
end

View File

@@ -90,10 +90,10 @@ describe Dashboard::Mailer do
expect(email).to have_body_text("And to accompany you in this challenge, "\
"here are the news...")
expect(email).to have_body_text("NEW UNLOCKED RESOURCE")
expect(email).to have_body_text("#{resource.title}")
expect(email).to have_body_text(resource.title)
expect(email).to have_body_text("Take a look at this NEW recommended ACTION:")
expect(email).to have_body_text("#{action.title}")
expect(email).to have_body_text("#{action.description}")
expect(email).to have_body_text(action.title)
expect(email).to have_body_text(action.description)
expect(email).to have_body_text("As always, enter the Proposals Panel and we will tell "\
"you in detail how to use these resources and how to get "\
"the most out of it.")
@@ -128,7 +128,7 @@ describe Dashboard::Mailer do
expect(email).to have_body_text("And so, you have a new resource available to help "\
"you keep moving forward.")
expect(email).to have_body_text("NEW UNLOCKED RESOURCE")
expect(email).to have_body_text("#{resource.title}")
expect(email).to have_body_text(resource.title)
months_to_archive_proposals = Setting["months_to_archive_proposals"].to_i.months
limit_to_archive_proposal = proposal.created_at.to_date + months_to_archive_proposals
@@ -139,8 +139,8 @@ describe Dashboard::Mailer do
"supports and goes to referendum. Cheer up and keep "\
"spreading. Are you short of ideas?")
expect(email).to have_body_text("NEW RECOMMENDED DIFFUSION ACTION")
expect(email).to have_body_text("#{action.title}")
expect(email).to have_body_text("#{action.description}")
expect(email).to have_body_text(action.title)
expect(email).to have_body_text(action.description)
expect(email).to have_body_text("As always, enter the Proposals Panel and we will tell "\
"you in detail how to use these resources and how to get "\
"the most out of it.")

View File

@@ -36,7 +36,7 @@ shared_examples "relationable" do |relationable_model_name|
expect(page).to have_css ".add-related-content[aria-expanded='true']"
within("#related_content") do
fill_in "Link to related content", with: "#{url + related1.url}"
fill_in "Link to related content", with: "#{url}#{related1.url}"
click_button "Add"
end
@@ -53,7 +53,7 @@ shared_examples "relationable" do |relationable_model_name|
click_button "Add related content"
within("#related_content") do
fill_in "Link to related content", with: "#{url + related2.url}"
fill_in "Link to related content", with: "#{url}#{related2.url}"
click_button "Add"
end

View File

@@ -293,7 +293,7 @@ describe "Admin polls", :admin do
within("#totals") do
within("#total_final") do
expect(page).to have_content("#{55555 + 63}")
expect(page).to have_content(55555 + 63)
end
within("#total_system") do

View File

@@ -29,13 +29,13 @@ describe "Admin users" do
visit admin_users_path
expect(page).not_to have_link("#{erased_user.id}", href: user_path(erased_user))
expect(page).not_to have_link(erased_user.id.to_s, href: user_path(erased_user))
expect(page).to have_link("Erased")
click_link "Erased"
expect(page).to have_link("Active")
expect(page).to have_link("#{erased_user.id}", href: user_path(erased_user))
expect(page).to have_link(erased_user.id.to_s, href: user_path(erased_user))
expect(page).to have_content "I don't like this site."
expect(page).to have_content("Erased")

View File

@@ -26,7 +26,7 @@ describe "Poll budget ballot sheets" do
end
within("#poll_#{poll.id}") do
expect(page).to have_content("#{poll.name}")
expect(page).to have_content(poll.name)
expect(page).to have_content("See ballot sheets list")
expect(page).to have_content("Add results")
end
@@ -51,7 +51,7 @@ describe "Poll budget ballot sheets" do
visit officing_poll_ballot_sheets_path(poll)
expect(page).to have_content "#{poll.name}"
expect(page).to have_content poll.name
end
scenario "Access ballot sheets officing with multiple booth assignments", :with_frozen_time do
@@ -103,7 +103,7 @@ describe "Poll budget ballot sheets" do
scenario "Ballot sheet is saved" do
visit new_officing_poll_ballot_sheet_path(poll)
select "#{booth.name}", from: "officer_assignment_id"
select booth.name, from: "officer_assignment_id"
fill_in "data", with: "1234;5678"
click_button "Save"
@@ -119,7 +119,7 @@ describe "Poll budget ballot sheets" do
scenario "Ballot sheet is not saved" do
visit new_officing_poll_ballot_sheet_path(poll)
select "#{booth.name}", from: "officer_assignment_id"
select booth.name, from: "officer_assignment_id"
click_button "Save"
expect(page).to have_content("CSV data can't be blank")

View File

@@ -155,7 +155,7 @@ describe "Legislation" do
phases.each do |phase|
within(".legislation-process-list") do
find("li", text: "#{phase}").click_link
find("li", text: phase).click_link
end
expect(page).to have_content(document.title)