Fix FormatStringToken cop in CLI (#25122)

pull/25197/head
Matt Jankowski 2023-05-30 10:21:53 -04:00 committed by GitHub
parent dbc44be0ca
commit 1baf40077b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -951,7 +951,6 @@ Style/FormatStringToken:
Exclude: Exclude:
- 'app/models/privacy_policy.rb' - 'app/models/privacy_policy.rb'
- 'config/initializers/devise.rb' - 'config/initializers/devise.rb'
- 'lib/mastodon/cli/maintenance.rb'
- 'lib/paperclip/color_extractor.rb' - 'lib/paperclip/color_extractor.rb'
# This cop supports unsafe autocorrection (--autocorrect-all). # This cop supports unsafe autocorrection (--autocorrect-all).

View File

@ -551,7 +551,16 @@ module Mastodon::CLI
@prompt.warn 'All those accounts are distinct accounts but only the most recently-created one is fully-functional.' @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| accounts.each_with_index do |account, idx|
@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') @prompt.say format(
'%<index>2d. %<username>s: created at: %<created_at>s; updated at: %<updated_at>s; last logged in at: %<last_log_in_at>s; statuses: %<status_count>5d; last status at: %<last_status_at>s',
index: idx,
username: account.username,
created_at: account.created_at,
updated_at: account.updated_at,
last_log_in_at: account.user&.last_sign_in_at&.to_s || 'N/A',
status_count: account.account_stat&.statuses_count || 0,
last_status_at: account.account_stat&.last_status_at || 'N/A'
)
end end
@prompt.say 'Please chose the one to keep unchanged, other ones will be automatically renamed.' @prompt.say 'Please chose the one to keep unchanged, other ones will be automatically renamed.'