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:
Enabled: true
Lint/BooleanSymbol:
Enabled: true
Lint/ConstantDefinitionInBlock:
Enabled: true
@@ -449,12 +452,21 @@ Style/PercentLiteralDelimiters:
Style/Proc:
Enabled: true
Style/RaiseArgs:
Enabled: true
Style/RedundantCondition:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantFreeze:
Enabled: true
Style/RedundantInterpolation:
Enabled: true
Style/RedundantReturn:
Enabled: true

View File

@@ -107,7 +107,7 @@ group :development do
gem "pronto-eslint", "~> 0.11.0", require: false
gem "pronto-rubocop", "~> 0.11.1", 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-rails", "~> 2.6.0", require: false
gem "rubocop-rspec", "~> 1.44.1", require: false

View File

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

View File

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

View File

@@ -26,7 +26,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
private
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"]

View File

@@ -105,7 +105,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
def restrict_access
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
@@ -114,7 +114,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
Budget::ValuatorAssignment.exists?(investment_id: params[:id],
valuator_id: current_user.valuator.id)
raise ActionController::RoutingError.new("Not Found")
raise ActionController::RoutingError, "Not Found"
end
def valid_price_params?

View File

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

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

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

View File

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

View File

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

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

@@ -1,5 +1,5 @@
class AddPublishedProposalToDashboardActions < ActiveRecord::Migration[4.2]
def change
add_column :dashboard_actions, :published_proposal, :boolean, default: :false
add_column :dashboard_actions, :published_proposal, :boolean, default: false
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, "\
"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)