Class: RuboCop::Cop::StimulusReflex::ReflexMethodNames

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/stimulus_reflex/reflex_method_names.rb

Constant Summary collapse

NOT_RECOMMENED_METHOD_NAMES =
[:send].freeze

Instance Method Summary collapse

Methods inherited from Base

inherited

Instance Method Details

#on_def(definition) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/stimulus_reflex/reflex_method_names.rb', line 9

def on_def(definition)
  name = definition.method_name

  return unless NOT_RECOMMENED_METHOD_NAMES.include?(name)

  add_offense(
    definition,
    message: "It's not recommended to use `#{name}` as a reflex method name."
  )
end