Autofix Rubocop Style/RescueStandardError (#23745)

pull/53/head
Nick Schonning 2023-02-20 05:01:20 -05:00 committed by GitHub
parent 62c4aecf8f
commit 59c8d43d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 24 deletions

View File

@ -115,6 +115,9 @@ Style/PercentLiteralDelimiters:
'%i': '()'
'%w': '()'
Style/RescueStandardError:
EnforcedStyle: implicit
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: 'comma'

View File

@ -2234,24 +2234,6 @@ Style/RegexpLiteral:
- 'lib/mastodon/premailer_webpack_strategy.rb'
- 'lib/tasks/mastodon.rake'
# Offense count: 21
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Exclude:
- 'app/lib/activitypub/activity/move.rb'
- 'app/lib/request.rb'
- 'app/models/account.rb'
- 'app/workers/move_worker.rb'
- 'app/workers/scheduler/vacuum_scheduler.rb'
- 'lib/mastodon/accounts_cli.rb'
- 'lib/mastodon/cli_helper.rb'
- 'lib/mastodon/media_cli.rb'
- 'lib/mastodon/sidekiq_middleware.rb'
- 'lib/mastodon/statuses_cli.rb'
- 'lib/mastodon/upgrade_cli.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.

View File

@ -64,7 +64,7 @@ class RequestPool
retries += 1
retry
end
rescue StandardError
rescue
# If this connection raises errors of any kind, it's
# better if it gets reaped as soon as possible

View File

@ -114,7 +114,7 @@ class ImportService < BaseService
status || ActivityPub::FetchRemoteStatusService.new.call(uri)
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError
nil
rescue StandardError => e
rescue => e
Rails.logger.warn "Unexpected error when importing bookmark: #{e}"
nil
end

View File

@ -165,7 +165,7 @@ module Mastodon
stats[domain]['activity'] = Oj.load(res.to_s)
end
rescue StandardError
rescue
failed.increment
ensure
processed.increment

View File

@ -92,7 +92,7 @@ namespace :mastodon do
prompt.ok 'Database configuration works! 🎆'
db_connection_works = true
break
rescue StandardError => e
rescue => e
prompt.error 'Database connection could not be established with this configuration, try again.'
prompt.error e.message
break unless prompt.yes?('Try again?')
@ -132,7 +132,7 @@ namespace :mastodon do
redis.ping
prompt.ok 'Redis configuration works! 🎆'
break
rescue StandardError => e
rescue => e
prompt.error 'Redis connection could not be established with this configuration, try again.'
prompt.error e.message
break unless prompt.yes?('Try again?')
@ -417,7 +417,7 @@ namespace :mastodon do
mail = ActionMailer::Base.new.mail to: send_to, subject: 'Test', body: 'Mastodon SMTP configuration works!'
mail.deliver
break
rescue StandardError => e
rescue => e
prompt.error 'E-mail could not be sent with this configuration, try again.'
prompt.error e.message
break unless prompt.yes?('Try again?')