Class: RuboCop::Cop::G2::BanSidekiqWorker
- Inherits:
-
Cop
- Object
- Cop
- RuboCop::Cop::G2::BanSidekiqWorker
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/g2/ban_sidekiq_worker.rb
Constant Summary collapse
- MSG =
'Please use Sidekiq::Job instead of Sidekiq::Worker'.freeze
- RESTRICT_ON_SEND =
[:include].freeze
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
19 20 21 22 23 |
# File 'lib/rubocop/cop/g2/ban_sidekiq_worker.rb', line 19 def autocorrect(node) lambda do |corrector| corrector.replace(node, node.source.gsub('Worker', 'Job')) end end |
#on_send(node) ⇒ Object
14 15 16 17 |
# File 'lib/rubocop/cop/g2/ban_sidekiq_worker.rb', line 14 def on_send(node) return unless sidekiq_worker?(node) add_offense(node, location: :expression) end |