Autofix Rubocop Style/RescueStandardError (#23745)
parent
62c4aecf8f
commit
59c8d43d94
|
@ -115,6 +115,9 @@ Style/PercentLiteralDelimiters:
|
||||||
'%i': '()'
|
'%i': '()'
|
||||||
'%w': '()'
|
'%w': '()'
|
||||||
|
|
||||||
|
Style/RescueStandardError:
|
||||||
|
EnforcedStyle: implicit
|
||||||
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
Style/TrailingCommaInArrayLiteral:
|
||||||
EnforcedStyleForMultiline: 'comma'
|
EnforcedStyleForMultiline: 'comma'
|
||||||
|
|
||||||
|
|
|
@ -2234,24 +2234,6 @@ Style/RegexpLiteral:
|
||||||
- 'lib/mastodon/premailer_webpack_strategy.rb'
|
- 'lib/mastodon/premailer_webpack_strategy.rb'
|
||||||
- 'lib/tasks/mastodon.rake'
|
- '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
|
# Offense count: 2
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
||||||
|
|
|
@ -64,7 +64,7 @@ class RequestPool
|
||||||
retries += 1
|
retries += 1
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
rescue StandardError
|
rescue
|
||||||
# If this connection raises errors of any kind, it's
|
# If this connection raises errors of any kind, it's
|
||||||
# better if it gets reaped as soon as possible
|
# better if it gets reaped as soon as possible
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ImportService < BaseService
|
||||||
status || ActivityPub::FetchRemoteStatusService.new.call(uri)
|
status || ActivityPub::FetchRemoteStatusService.new.call(uri)
|
||||||
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError
|
rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError
|
||||||
nil
|
nil
|
||||||
rescue StandardError => e
|
rescue => e
|
||||||
Rails.logger.warn "Unexpected error when importing bookmark: #{e}"
|
Rails.logger.warn "Unexpected error when importing bookmark: #{e}"
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -165,7 +165,7 @@ module Mastodon
|
||||||
|
|
||||||
stats[domain]['activity'] = Oj.load(res.to_s)
|
stats[domain]['activity'] = Oj.load(res.to_s)
|
||||||
end
|
end
|
||||||
rescue StandardError
|
rescue
|
||||||
failed.increment
|
failed.increment
|
||||||
ensure
|
ensure
|
||||||
processed.increment
|
processed.increment
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace :mastodon do
|
||||||
prompt.ok 'Database configuration works! 🎆'
|
prompt.ok 'Database configuration works! 🎆'
|
||||||
db_connection_works = true
|
db_connection_works = true
|
||||||
break
|
break
|
||||||
rescue StandardError => e
|
rescue => e
|
||||||
prompt.error 'Database connection could not be established with this configuration, try again.'
|
prompt.error 'Database connection could not be established with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
break unless prompt.yes?('Try again?')
|
||||||
|
@ -132,7 +132,7 @@ namespace :mastodon do
|
||||||
redis.ping
|
redis.ping
|
||||||
prompt.ok 'Redis configuration works! 🎆'
|
prompt.ok 'Redis configuration works! 🎆'
|
||||||
break
|
break
|
||||||
rescue StandardError => e
|
rescue => e
|
||||||
prompt.error 'Redis connection could not be established with this configuration, try again.'
|
prompt.error 'Redis connection could not be established with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
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 = ActionMailer::Base.new.mail to: send_to, subject: 'Test', body: 'Mastodon SMTP configuration works!'
|
||||||
mail.deliver
|
mail.deliver
|
||||||
break
|
break
|
||||||
rescue StandardError => e
|
rescue => e
|
||||||
prompt.error 'E-mail could not be sent with this configuration, try again.'
|
prompt.error 'E-mail could not be sent with this configuration, try again.'
|
||||||
prompt.error e.message
|
prompt.error e.message
|
||||||
break unless prompt.yes?('Try again?')
|
break unless prompt.yes?('Try again?')
|
||||||
|
|
Reference in New Issue