Class: RuboCop::Cop::Sidekiq::SymbolArgument
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sidekiq::SymbolArgument
- Includes:
- Helpers
- Defined in:
- lib/rubocop/cop/sidekiq/symbol_argument.rb
Overview
This cop checks for symbols passed as arguments to a Sidekiq worker’s perform method. Symbols cannot be properly serialized for Redis and should be avoided. Use strings instead.
Constant Summary collapse
- MSG =
'Symbols are not Sidekiq-serializable; use strings instead.'
Constants included from Helpers
Instance Method Summary collapse
Methods included from Helpers
#approve_node, #expand_arguments, #in_sidekiq_worker?, included, #node_approved?, #sidekiq_arguments, #within?
Instance Method Details
#on_send(node) ⇒ Object
23 24 25 26 27 |
# File 'lib/rubocop/cop/sidekiq/symbol_argument.rb', line 23 def on_send(node) sidekiq_arguments(node).select(&:sym_type?).each do |argument| add_offense(argument) end end |