Merge pull request #4215 from consul/dependabot/bundler/rubocop-0.93.1

Bump rubocop from 0.91.1 to 0.93.1
This commit is contained in:
Javi Martín
2021-08-10 13:15:52 +02:00
committed by GitHub
19 changed files with 52 additions and 48 deletions

View File

@@ -172,6 +172,9 @@ Layout/TrailingWhitespace:
Lint/AmbiguousRegexpLiteral: Lint/AmbiguousRegexpLiteral:
Enabled: true Enabled: true
Lint/BooleanSymbol:
Enabled: true
Lint/ConstantDefinitionInBlock: Lint/ConstantDefinitionInBlock:
Enabled: true Enabled: true
@@ -449,12 +452,21 @@ Style/PercentLiteralDelimiters:
Style/Proc: Style/Proc:
Enabled: true Enabled: true
Style/RaiseArgs:
Enabled: true
Style/RedundantCondition:
Enabled: true
Style/RedundantFileExtensionInRequire: Style/RedundantFileExtensionInRequire:
Enabled: true Enabled: true
Style/RedundantFreeze: Style/RedundantFreeze:
Enabled: true Enabled: true
Style/RedundantInterpolation:
Enabled: true
Style/RedundantReturn: Style/RedundantReturn:
Enabled: true Enabled: true

View File

@@ -107,7 +107,7 @@ group :development do
gem "pronto-eslint", "~> 0.11.0", require: false gem "pronto-eslint", "~> 0.11.0", require: false
gem "pronto-rubocop", "~> 0.11.1", require: false gem "pronto-rubocop", "~> 0.11.1", require: false
gem "pronto-scss", "~> 0.11.0", require: false gem "pronto-scss", "~> 0.11.0", require: false
gem "rubocop", "~> 0.91.0", require: false gem "rubocop", "~> 0.93.1", require: false
gem "rubocop-performance", "~> 1.7.1", require: false gem "rubocop-performance", "~> 1.7.1", require: false
gem "rubocop-rails", "~> 2.6.0", require: false gem "rubocop-rails", "~> 2.6.0", require: false
gem "rubocop-rspec", "~> 1.44.1", require: false gem "rubocop-rspec", "~> 1.44.1", require: false

View File

@@ -542,17 +542,17 @@ GEM
rspec-mocks (~> 3.9) rspec-mocks (~> 3.9)
rspec-support (~> 3.9) rspec-support (~> 3.9)
rspec-support (3.9.3) rspec-support (3.9.3)
rubocop (0.91.1) rubocop (0.93.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.1.1) parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7) regexp_parser (>= 1.8)
rexml rexml
rubocop-ast (>= 0.4.0, < 1.0) rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.8.0) rubocop-ast (1.9.0)
parser (>= 2.7.1.5) parser (>= 3.0.1.1)
rubocop-performance (1.7.1) rubocop-performance (1.7.1)
rubocop (>= 0.82.0) rubocop (>= 0.82.0)
rubocop-rails (2.6.0) rubocop-rails (2.6.0)
@@ -770,7 +770,7 @@ DEPENDENCIES
rinku (~> 2.0.6) rinku (~> 2.0.6)
rollbar (~> 3.1.2) rollbar (~> 3.1.2)
rspec-rails (~> 4.0) rspec-rails (~> 4.0)
rubocop (~> 0.91.0) rubocop (~> 0.93.1)
rubocop-performance (~> 1.7.1) rubocop-performance (~> 1.7.1)
rubocop-rails (~> 2.6.0) rubocop-rails (~> 2.6.0)
rubocop-rspec (~> 1.44.1) rubocop-rspec (~> 1.44.1)

View File

@@ -13,7 +13,7 @@ class Management::BaseController < ActionController::Base
private private
def verify_manager def verify_manager
raise ActionController::RoutingError.new("Not Found") if current_manager.blank? raise ActionController::RoutingError, "Not Found" if current_manager.blank?
end end
def current_manager def current_manager

View File

@@ -26,7 +26,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
private private
def sign_in_with(feature, provider) def sign_in_with(feature, provider)
raise ActionController::RoutingError.new("Not Found") unless Setting["feature.#{feature}"] raise ActionController::RoutingError, "Not Found" unless Setting["feature.#{feature}"]
auth = request.env["omniauth.auth"] auth = request.env["omniauth.auth"]

View File

@@ -105,7 +105,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
def restrict_access def restrict_access
unless current_user.administrator? || current_budget.valuating? unless current_user.administrator? || current_budget.valuating?
raise CanCan::AccessDenied.new(I18n.t("valuation.budget_investments.not_in_valuating_phase")) raise CanCan::AccessDenied, I18n.t("valuation.budget_investments.not_in_valuating_phase")
end end
end end
@@ -114,7 +114,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
Budget::ValuatorAssignment.exists?(investment_id: params[:id], Budget::ValuatorAssignment.exists?(investment_id: params[:id],
valuator_id: current_user.valuator.id) valuator_id: current_user.valuator.id)
raise ActionController::RoutingError.new("Not Found") raise ActionController::RoutingError, "Not Found"
end end
def valid_price_params? def valid_price_params?

View File

@@ -130,9 +130,7 @@ module GlobalizeHelper
hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0)) hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0))
end end
def globalize(locale) def globalize(locale, &block)
Globalize.with_locale(locale) do Globalize.with_locale(locale, &block)
yield
end
end end
end end

View File

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

View File

@@ -1,8 +1,6 @@
module TranslatableFormHelper module TranslatableFormHelper
def translatable_form_for(record, options = {}) def translatable_form_for(record, options = {}, &block)
form_for(record, options.merge(builder: TranslatableFormBuilder)) do |f| form_for(record, options.merge(builder: TranslatableFormBuilder), &block)
yield(f)
end
end end
def translations_interface_enabled? def translations_interface_enabled?
@@ -48,10 +46,8 @@ module TranslatableFormHelper
end end
end end
def fields_for_translation(translation) def fields_for_translation(translation, &block)
fields_for(:translations, translation, builder: TranslationsFieldsBuilder) do |f| fields_for(:translations, translation, builder: TranslationsFieldsBuilder, &block)
yield f
end
end end
def translation_for(locale) def translation_for(locale)

View File

@@ -34,7 +34,7 @@ module WelcomeHelper
def calculate_carousel_size(debates, proposals, apply_offset) def calculate_carousel_size(debates, proposals, apply_offset)
offset = calculate_offset(debates, proposals, apply_offset) offset = calculate_offset(debates, proposals, apply_offset)
centered = calculate_centered(debates, proposals) centered = calculate_centered(debates, proposals)
"#{offset if offset} #{centered if centered}" "#{offset} #{centered}"
end end
def calculate_centered(debates, proposals) def calculate_centered(debates, proposals)

View File

@@ -129,10 +129,8 @@ class Mailer < ApplicationMailer
private private
def with_user(user) def with_user(user, &block)
I18n.with_locale(user.locale) do I18n.with_locale(user.locale, &block)
yield
end
end end
def prevent_delivery_to_users_without_email def prevent_delivery_to_users_without_email

View File

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

View File

@@ -1,5 +1,5 @@
class AddPublishedProposalToDashboardActions < ActiveRecord::Migration[4.2] class AddPublishedProposalToDashboardActions < ActiveRecord::Migration[4.2]
def change def change
add_column :dashboard_actions, :published_proposal, :boolean, default: :false add_column :dashboard_actions, :published_proposal, :boolean, default: false
end end
end end

View File

@@ -90,10 +90,10 @@ describe Dashboard::Mailer do
expect(email).to have_body_text("And to accompany you in this challenge, "\ expect(email).to have_body_text("And to accompany you in this challenge, "\
"here are the news...") "here are the news...")
expect(email).to have_body_text("NEW UNLOCKED RESOURCE") 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("Take a look at this NEW recommended ACTION:")
expect(email).to have_body_text("#{action.title}") expect(email).to have_body_text(action.title)
expect(email).to have_body_text("#{action.description}") expect(email).to have_body_text(action.description)
expect(email).to have_body_text("As always, enter the Proposals Panel and we will tell "\ 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 "\ "you in detail how to use these resources and how to get "\
"the most out of it.") "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 "\ expect(email).to have_body_text("And so, you have a new resource available to help "\
"you keep moving forward.") "you keep moving forward.")
expect(email).to have_body_text("NEW UNLOCKED RESOURCE") 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 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 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 "\ "supports and goes to referendum. Cheer up and keep "\
"spreading. Are you short of ideas?") "spreading. Are you short of ideas?")
expect(email).to have_body_text("NEW RECOMMENDED DIFFUSION ACTION") 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.title)
expect(email).to have_body_text("#{action.description}") expect(email).to have_body_text(action.description)
expect(email).to have_body_text("As always, enter the Proposals Panel and we will tell "\ 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 "\ "you in detail how to use these resources and how to get "\
"the most out of it.") "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']" expect(page).to have_css ".add-related-content[aria-expanded='true']"
within("#related_content") do 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" click_button "Add"
end end
@@ -53,7 +53,7 @@ shared_examples "relationable" do |relationable_model_name|
click_button "Add related content" click_button "Add related content"
within("#related_content") do 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" click_button "Add"
end end

View File

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

View File

@@ -29,13 +29,13 @@ describe "Admin users" do
visit admin_users_path 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") expect(page).to have_link("Erased")
click_link "Erased" click_link "Erased"
expect(page).to have_link("Active") 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 "I don't like this site."
expect(page).to have_content("Erased") expect(page).to have_content("Erased")

View File

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

View File

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