From 933189887bcfa9d84e0d4176446a99002a80ebb8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 19 Apr 2024 16:33:00 -0400 Subject: [PATCH] Fix `Style/StringLiterals` cop (#30005) --- .rubocop_todo.yml | 12 ------------ config/environments/production.rb | 4 ++-- config/initializers/backtrace_silencers.rb | 2 +- config/initializers/http_client_proxy.rb | 4 ++-- config/initializers/rack_attack.rb | 2 +- config/initializers/webauthn.rb | 2 +- config/routes.rb | 2 +- 7 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ac65c15895..13f7b8c09b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -241,18 +241,6 @@ Style/StringConcatenation: Exclude: - 'config/initializers/paperclip.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'config/environments/production.rb' - - 'config/initializers/backtrace_silencers.rb' - - 'config/initializers/http_client_proxy.rb' - - 'config/initializers/rack_attack.rb' - - 'config/initializers/webauthn.rb' - - 'config/routes.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyleForMultiline. # SupportedStylesForMultiline: comma, consistent_comma, no_comma diff --git a/config/environments/production.rb b/config/environments/production.rb index 11da32f18a..6587acfb3a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "active_support/core_ext/integer/time" +require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.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/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 74f30e8875..d43cc1d2fe 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -7,4 +7,4 @@ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". -Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] +Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE'] diff --git a/config/initializers/http_client_proxy.rb b/config/initializers/http_client_proxy.rb index 7332ffb53b..93a8d33ff9 100644 --- a/config/initializers/http_client_proxy.rb +++ b/config/initializers/http_client_proxy.rb @@ -7,7 +7,7 @@ Rails.application.configure do proxy = URI.parse(ENV['http_proxy']) raise "Unsupported proxy type: #{proxy.scheme}" unless %w(http https).include? proxy.scheme - raise "No proxy host" unless proxy.host + raise 'No proxy host' unless proxy.host host = proxy.host host = host[1...-1] if host[0] == '[' # for IPv6 address @@ -24,7 +24,7 @@ Rails.application.configure do proxy = URI.parse(ENV['http_hidden_proxy']) raise "Unsupported proxy type: #{proxy.scheme}" unless %w(http https).include? proxy.scheme - raise "No proxy host" unless proxy.host + raise 'No proxy host' unless proxy.host host = proxy.host host = host[1...-1] if host[0] == '[' # for IPv6 address diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 429dbd3248..fa1bdca544 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -14,7 +14,7 @@ class Rack::Attack end def remote_ip - @remote_ip ||= (@env["action_dispatch.remote_ip"] || ip).to_s + @remote_ip ||= (@env['action_dispatch.remote_ip'] || ip).to_s end def throttleable_remote_ip diff --git a/config/initializers/webauthn.rb b/config/initializers/webauthn.rb index 924ce6d877..40dfeb8317 100644 --- a/config/initializers/webauthn.rb +++ b/config/initializers/webauthn.rb @@ -6,7 +6,7 @@ WebAuthn.configure do |config| config.origin = "#{Rails.configuration.x.use_https ? 'https' : 'http'}://#{Rails.configuration.x.web_domain}" # Relying Party name for display purposes - config.rp_name = "Mastodon" + config.rp_name = 'Mastodon' # Optionally configure a client timeout hint, in milliseconds. # This hint specifies how long the browser should wait for an diff --git a/config/routes.rb b/config/routes.rb index d032b5110f..3d3c94096c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -139,7 +139,7 @@ Rails.application.routes.draw do resource :inbox, only: [:create], module: :activitypub - get '/:encoded_at(*path)', to: redirect("/@%{path}"), constraints: { encoded_at: /%40/ } + get '/:encoded_at(*path)', to: redirect('/@%{path}'), constraints: { encoded_at: /%40/ } constraints(username: %r{[^@/.]+}) do with_options to: 'accounts#show' do