Browse Source

Autofix Rubocop Style/RescueStandardError (#23745)

closed-social-glitch-2
Nick Schonning 1 year ago
committed by GitHub
parent
commit
59c8d43d94
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 24 deletions
  1. +3
    -0
      .rubocop.yml
  2. +0
    -18
      .rubocop_todo.yml
  3. +1
    -1
      app/lib/request_pool.rb
  4. +1
    -1
      app/services/import_service.rb
  5. +1
    -1
      lib/mastodon/domains_cli.rb
  6. +3
    -3
      lib/tasks/mastodon.rake

+ 3
- 0
.rubocop.yml View File

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

+ 0
- 18
.rubocop_todo.yml 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.

+ 1
- 1
app/lib/request_pool.rb 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

+ 1
- 1
app/services/import_service.rb 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

+ 1
- 1
lib/mastodon/domains_cli.rb 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

+ 3
- 3
lib/tasks/mastodon.rake 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?')

Loading…
Cancel
Save