From c875dfc90b82358bd936e979ce313d62a7c7a730 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 9 Nov 2023 04:43:26 -0500 Subject: [PATCH] Fix `Lint/UnusedBlockArgument` cop (#27777) --- .rubocop_todo.yml | 9 --------- config/initializers/content_security_policy.rb | 4 ++-- config/initializers/doorkeeper.rb | 2 +- config/initializers/paperclip.rb | 4 ++-- config/initializers/simple_form.rb | 2 +- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a59f65519..0e416482e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -24,15 +24,6 @@ Lint/NonLocalExitFromIterator: Exclude: - 'app/helpers/jsonld_helper.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: - Exclude: - - 'config/initializers/content_security_policy.rb' - - 'config/initializers/doorkeeper.rb' - - 'config/initializers/paperclip.rb' - - 'config/initializers/simple_form.rb' - # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 144 diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index f728acfd3..3fb80bac4 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -67,7 +67,7 @@ end # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only # Rails.application.config.content_security_policy_report_only = true -Rails.application.config.content_security_policy_nonce_generator = ->(request) { SecureRandom.base64(16) } +Rails.application.config.content_security_policy_nonce_generator = ->(_request) { SecureRandom.base64(16) } Rails.application.config.content_security_policy_nonce_directives = %w(style-src) @@ -92,7 +92,7 @@ Rails.application.reloader.to_prepare do p.worker_src :none end - LetterOpenerWeb::LettersController.after_action do |p| + LetterOpenerWeb::LettersController.after_action do request.content_security_policy_nonce_directives = %w(script-src) end end diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index a78405ace..fe3871d2e 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -169,7 +169,7 @@ Doorkeeper.configure do # Under some circumstances you might want to have applications auto-approved, # so that the user skips the authorization step. # For example if dealing with a trusted application. - skip_authorization do |resource_owner, client| + skip_authorization do |_resource_owner, client| client.application.superapp? end diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 03e5fdbb8..a44c2ab84 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -11,7 +11,7 @@ Paperclip.interpolates :filename do |attachment, style| end end -Paperclip.interpolates :prefix_path do |attachment, style| +Paperclip.interpolates :prefix_path do |attachment, _style| if attachment.storage_schema_version >= 1 && attachment.instance.respond_to?(:local?) && !attachment.instance.local? 'cache' + File::SEPARATOR else @@ -19,7 +19,7 @@ Paperclip.interpolates :prefix_path do |attachment, style| end end -Paperclip.interpolates :prefix_url do |attachment, style| +Paperclip.interpolates :prefix_url do |attachment, _style| if attachment.storage_schema_version >= 1 && attachment.instance.respond_to?(:local?) && !attachment.instance.local? 'cache/' else diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index a7a2d251e..6d9d7b8ae 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -164,7 +164,7 @@ SimpleForm.setup do |config| # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. - config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" } + config.label_text = lambda { |label, required, _explicit_label| "#{label} #{required}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil