Add and apply ShadowingOuterLocalVariable rule
Naming two variables the same way is confusing at the very least, and can lead to hard to debug errors. That's why the Ruby interpreter issues a warning when we do so.
This commit is contained in:
@@ -120,6 +120,9 @@ Layout/TrailingWhitespace:
|
||||
Lint/LiteralAsCondition:
|
||||
Enabled: true
|
||||
|
||||
Lint/ShadowingOuterLocalVariable:
|
||||
Enabled: true
|
||||
|
||||
Lint/UselessAssignment:
|
||||
Enabled: true
|
||||
|
||||
|
||||
@@ -58,14 +58,13 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController
|
||||
}
|
||||
]
|
||||
|
||||
filters = investment_headings.inject(all_headings_filter) do |filters, heading|
|
||||
investment_headings.inject(all_headings_filter) do |filters, heading|
|
||||
filters << {
|
||||
name: heading.name,
|
||||
id: heading.id,
|
||||
count: investments.select { |i| i.heading_id == heading.id }.size
|
||||
}
|
||||
end
|
||||
filters.uniq
|
||||
end.uniq
|
||||
end
|
||||
|
||||
def restrict_access_to_assigned_items
|
||||
|
||||
@@ -222,10 +222,10 @@ section "Creating Poll Questions from Proposals" do
|
||||
poll = Poll.current.first
|
||||
question = Poll::Question.new(poll: poll)
|
||||
question.copy_attributes_from_proposal(proposal)
|
||||
title = question.title
|
||||
question_title = question.title
|
||||
I18n.available_locales.map do |locale|
|
||||
Globalize.with_locale(locale) do
|
||||
question.title = "#{title} (#{locale})"
|
||||
question.title = "#{question_title} (#{locale})"
|
||||
end
|
||||
end
|
||||
question.save!
|
||||
@@ -252,10 +252,10 @@ section "Creating Successful Proposals" do
|
||||
poll = Poll.current.first
|
||||
question = Poll::Question.new(poll: poll)
|
||||
question.copy_attributes_from_proposal(proposal)
|
||||
title = question.title
|
||||
question_title = question.title
|
||||
I18n.available_locales.map do |locale|
|
||||
Globalize.with_locale(locale) do
|
||||
question.title = "#{title} (#{locale})"
|
||||
question.title = "#{question_title} (#{locale})"
|
||||
end
|
||||
end
|
||||
question.save!
|
||||
|
||||
@@ -1773,8 +1773,8 @@ describe "Admin budget investments" do
|
||||
visit admin_budget_budget_investments_path(budget)
|
||||
|
||||
cookies = page.driver.browser.manage.all_cookies
|
||||
cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = cookie[:value]
|
||||
columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = columns_cookie[:value]
|
||||
|
||||
expect(cookie_value).to eq("id,title,supports,admin,valuator,geozone," +
|
||||
"feasibility,price,valuation_finished,visible_to_valuators,selected,incompatible")
|
||||
@@ -1827,8 +1827,8 @@ describe "Admin budget investments" do
|
||||
end
|
||||
|
||||
cookies = page.driver.browser.manage.all_cookies
|
||||
cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = cookie[:value]
|
||||
columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = columns_cookie[:value]
|
||||
|
||||
expect(cookie_value).to eq("id,supports,admin,geozone," +
|
||||
"feasibility,valuation_finished,visible_to_valuators,selected,incompatible,author")
|
||||
@@ -1836,8 +1836,8 @@ describe "Admin budget investments" do
|
||||
visit admin_budget_budget_investments_path(budget)
|
||||
|
||||
cookies = page.driver.browser.manage.all_cookies
|
||||
cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = cookie[:value]
|
||||
columns_cookie = cookies.find { |cookie| cookie[:name] == "investments-columns" }
|
||||
cookie_value = columns_cookie[:value]
|
||||
|
||||
expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," +
|
||||
"visible_to_valuators,selected,incompatible,author")
|
||||
|
||||
Reference in New Issue
Block a user