Class: RuboCop::Cop::Sidekiq::MixedRetryStrategies

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/sidekiq/mixed_retry_strategies.rb

Overview

Checks for mixed ActiveJob and Sidekiq retry strategies in the same job.

Examples:

# bad
class MyJob < ApplicationJob
  retry_on SomeError
  sidekiq_options retry: 5
end

Constant Summary collapse

MSG =
'Avoid mixing ActiveJob retry_on with Sidekiq retry options.'

Instance Method Summary collapse

Methods included from Sidekiq::Language

#active_job_class?, #perform_call?, #sidekiq_include?, #sidekiq_options_call?

Instance Method Details

#on_class(node) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/rubocop/cop/sidekiq/mixed_retry_strategies.rb', line 18

def on_class(node)
  return unless active_job_class?(node)
  return unless retry_on_call?(node)

  sidekiq_retry_option_nodes(node).each do |send|
    add_offense(send)
  end
end