Class: RuboCop::Cop::Sidekiq::PerformInlineUsage
- Defined in:
- lib/rubocop/cop/sidekiq/perform_inline_usage.rb
Overview
Checks for usage of perform_inline in production code.
perform_inline executes the job synchronously, bypassing the
job queue. This can be useful in tests but should generally be
avoided in production code.
Constant Summary collapse
- MSG =
'Avoid using `perform_inline` in production code. ' \ 'Use `perform_async` instead.'
- RESTRICT_ON_SEND =
%i[perform_inline].freeze
Instance Method Summary collapse
- #on_send(node) ⇒ Object (also: #on_csend)
Methods included from Sidekiq::Language
#active_job_class?, #perform_call?, #sidekiq_include?, #sidekiq_options_call?
Instance Method Details
#on_send(node) ⇒ Object Also known as: on_csend
29 30 31 32 33 |
# File 'lib/rubocop/cop/sidekiq/perform_inline_usage.rb', line 29 def on_send(node) return if allowed_in_tests? && in_test_file? add_offense(node) end |