Class: RuboCop::Cop::Chewy::ResetOnType
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Chewy::ResetOnType
- Defined in:
- lib/rubocop/cop/chewy/reset_on_type.rb
Overview
This cop prevent usage of table_name= to in favor of convention.
# bad
UsersIndex::User.reset!
# good
UsersIndex.reset!
Constant Summary collapse
- MSG =
'Using reset or reset! on the type instead of the index will put Elasticsearch in an unhealthy state'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/rubocop/cop/chewy/reset_on_type.rb', line 20 def on_send(node) receiver, method_name, *_args = *node return unless %i[reset reset!].include? method_name return unless reset_on_type?(receiver) add_offense(node) end |