Class: RuboCop::Cop::Gusto::SidekiqParams

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/gusto/sidekiq_params.rb

Constant Summary collapse

MSG =
'Sidekiq perform methods cannot take keyword arguments'
PROHIBITED_ARG_TYPES =
Set.new(%i(kwoptarg kwarg)).freeze

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/rubocop/cop/gusto/sidekiq_params.rb', line 10

def on_def(node)
  return unless node.method?(:perform)
  return if node.arguments.empty?

  node.arguments.each_child_node do |arg|
    add_offense(node) if PROHIBITED_ARG_TYPES.include?(arg.type)
  end
end