From af4c95100c519ea63c9d8a3e9a3f900091933ce2 Mon Sep 17 00:00:00 2001
From: Nick Schonning <nschonni@gmail.com>
Date: Mon, 20 Feb 2023 01:58:33 -0500
Subject: [PATCH] Autofix Rubocop Style/FormatString (#23743)

---
 .rubocop_todo.yml                                 | 10 ----------
 app/serializers/rest/privacy_policy_serializer.rb |  2 +-
 lib/mastodon/maintenance_cli.rb                   |  2 +-
 lib/paperclip/color_extractor.rb                  |  2 +-
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index e667a77869..19d595e90d 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -2026,16 +2026,6 @@ Style/FetchEnvVar:
     - 'lib/tasks/repo.rake'
     - 'spec/features/profile_spec.rb'
 
-# Offense count: 3
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: format, sprintf, percent
-Style/FormatString:
-  Exclude:
-    - 'app/serializers/rest/privacy_policy_serializer.rb'
-    - 'lib/mastodon/maintenance_cli.rb'
-    - 'lib/paperclip/color_extractor.rb'
-
 # Offense count: 15
 # This cop supports safe autocorrection (--autocorrect).
 # Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
diff --git a/app/serializers/rest/privacy_policy_serializer.rb b/app/serializers/rest/privacy_policy_serializer.rb
index f0572e714d..57a67abf3c 100644
--- a/app/serializers/rest/privacy_policy_serializer.rb
+++ b/app/serializers/rest/privacy_policy_serializer.rb
@@ -8,7 +8,7 @@ class REST::PrivacyPolicySerializer < ActiveModel::Serializer
   end
 
   def content
-    markdown.render(object.text % { domain: Rails.configuration.x.local_domain })
+    markdown.render(format(object.text, domain: Rails.configuration.x.local_domain))
   end
 
   private
diff --git a/lib/mastodon/maintenance_cli.rb b/lib/mastodon/maintenance_cli.rb
index 3e644045f7..ff8f6ddda9 100644
--- a/lib/mastodon/maintenance_cli.rb
+++ b/lib/mastodon/maintenance_cli.rb
@@ -550,7 +550,7 @@ module Mastodon
       @prompt.warn 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.'
 
       accounts.each_with_index do |account, idx|
-        @prompt.say '%2d. %s: created at: %s; updated at: %s; last logged in at: %s; statuses: %5d; last status at: %s' % [idx, account.username, account.created_at, account.updated_at, account.user&.last_sign_in_at&.to_s || 'N/A', account.account_stat&.statuses_count || 0, account.account_stat&.last_status_at || 'N/A']
+        @prompt.say format('%2d. %s: created at: %s; updated at: %s; last logged in at: %s; statuses: %5d; last status at: %s', idx, account.username, account.created_at, account.updated_at, account.user&.last_sign_in_at&.to_s || 'N/A', account.account_stat&.statuses_count || 0, account.account_stat&.last_status_at || 'N/A')
       end
 
       @prompt.say 'Please chose the one to keep unchanged, other ones will be automatically renamed.'
diff --git a/lib/paperclip/color_extractor.rb b/lib/paperclip/color_extractor.rb
index 733dcba80b..2e8dc04fd8 100644
--- a/lib/paperclip/color_extractor.rb
+++ b/lib/paperclip/color_extractor.rb
@@ -183,7 +183,7 @@ module Paperclip
     end
 
     def rgb_to_hex(rgb)
-      '#%02x%02x%02x' % [rgb.r, rgb.g, rgb.b]
+      format('#%02x%02x%02x', rgb.r, rgb.g, rgb.b)
     end
   end
 end
-- 
GitLab