Enable Rubocop Style/StringConcatenation defaults (#23792)

This commit is contained in:
Nick Schonning
2023-02-21 19:54:36 -05:00
committed by GitHub
parent 7ecf783dd3
commit 0cfdd1a401
14 changed files with 25 additions and 44 deletions

View File

@ -68,7 +68,7 @@ module Mastodon
failed += 1
say('Failure/Error: ', :red)
say(entry.full_name)
say(' ' + custom_emoji.errors[:image].join(', '), :red)
say(" #{custom_emoji.errors[:image].join(', ')}", :red)
end
end
end

View File

@ -1,17 +1,17 @@
# frozen_string_literal: true
def setup_redis_env_url(prefix = nil, defaults = true)
prefix = prefix.to_s.upcase + '_' unless prefix.nil?
prefix = "#{prefix.to_s.upcase}_" unless prefix.nil?
prefix = '' if prefix.nil?
return if ENV[prefix + 'REDIS_URL'].present?
return if ENV["#{prefix}REDIS_URL"].present?
password = ENV.fetch(prefix + 'REDIS_PASSWORD') { '' if defaults }
host = ENV.fetch(prefix + 'REDIS_HOST') { 'localhost' if defaults }
port = ENV.fetch(prefix + 'REDIS_PORT') { 6379 if defaults }
db = ENV.fetch(prefix + 'REDIS_DB') { 0 if defaults }
password = ENV.fetch("#{prefix}REDIS_PASSWORD") { '' if defaults }
host = ENV.fetch("#{prefix}REDIS_HOST") { 'localhost' if defaults }
port = ENV.fetch("#{prefix}REDIS_PORT") { 6379 if defaults }
db = ENV.fetch("#{prefix}REDIS_DB") { 0 if defaults }
ENV[prefix + 'REDIS_URL'] = begin
ENV["#{prefix}REDIS_URL"] = begin
if [password, host, port, db].all?(&:nil?)
ENV['REDIS_URL']
else
@ -27,7 +27,7 @@ setup_redis_env_url(:cache, false)
setup_redis_env_url(:sidekiq, false)
namespace = ENV.fetch('REDIS_NAMESPACE', nil)
cache_namespace = namespace ? namespace + '_cache' : 'cache'
cache_namespace = namespace ? "#{namespace}_cache" : 'cache'
sidekiq_namespace = namespace
REDIS_CACHE_PARAMS = {

View File

@ -115,7 +115,7 @@ module Mastodon::Snowflake
# And only those that are using timestamp_id.
next unless (data = DEFAULT_REGEX.match(id_col.default_function))
seq_name = data[:seq_prefix] + '_id_seq'
seq_name = "#{data[:seq_prefix]}_id_seq"
# If we were on Postgres 9.5+, we could do CREATE SEQUENCE IF
# NOT EXISTS, but we can't depend on that. Instead, catch the

View File

@ -109,7 +109,7 @@ module Paperclip
final_file = Paperclip::Transcoder.make(file, options, attachment)
if options[:style] == :original
attachment.instance.file_file_name = File.basename(attachment.instance.file_file_name, '.*') + '.mp4'
attachment.instance.file_file_name = "#{File.basename(attachment.instance.file_file_name, '.*')}.mp4"
attachment.instance.file_content_type = 'video/mp4'
attachment.instance.type = MediaAttachment.types[:gifv]
end

View File

@ -7,7 +7,7 @@ module Paperclip
def make
return @file unless options[:format]
target_extension = '.' + options[:format]
target_extension = ".#{options[:format]}"
extension = File.extname(attachment.instance_read(:file_name))
return @file unless options[:style] == :original && target_extension && extension != target_extension