diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 6bbcb18c9..e6578c2d3 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -120,6 +120,9 @@ Layout/TrailingWhitespace: Lint/LiteralAsCondition: Enabled: true +Lint/ShadowingOuterLocalVariable: + Enabled: true + Lint/UselessAssignment: Enabled: true diff --git a/app/controllers/tracking/budget_investments_controller.rb b/app/controllers/tracking/budget_investments_controller.rb index 83a4f28d0..88315685c 100644 --- a/app/controllers/tracking/budget_investments_controller.rb +++ b/app/controllers/tracking/budget_investments_controller.rb @@ -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 diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 75ee07871..d284e93ae 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -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! diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 2ed59f9ee..86c8b8c4b 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -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")