From 33cc3ae8fa4467b1e3703c92652fdebc0ddd344a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 8 Nov 2023 07:01:18 -0500 Subject: [PATCH] Fix `Style/StabbyLambdaParentheses` cop (#27771) --- .rubocop_todo.yml | 8 -------- config/environments/production.rb | 2 +- config/initializers/content_security_policy.rb | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a2de86c2eb9..36d543b133f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -558,14 +558,6 @@ Style/SingleArgumentDig: Exclude: - 'lib/webpacker/manifest_extensions.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: require_parentheses, require_no_parentheses -Style/StabbyLambdaParentheses: - Exclude: - - 'config/environments/production.rb' - - 'config/initializers/content_security_policy.rb' - # This cop supports safe autocorrection (--autocorrect). Style/StderrPuts: Exclude: diff --git a/config/environments/production.rb b/config/environments/production.rb index 94e74699fc0..11da32f18ab 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -44,7 +44,7 @@ Rails.application.configure do config.force_ssl = true config.ssl_options = { redirect: { - exclude: ->request { request.path.start_with?('/health') || request.headers["Host"].end_with?('.onion') || request.headers["Host"].end_with?('.i2p') } + exclude: ->(request) { request.path.start_with?('/health') || request.headers["Host"].end_with?('.onion') || request.headers["Host"].end_with?('.i2p') } } } diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 8f8ea580288..f728acfd366 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)