Class: RuboCop::Cop::Obsession::Rails::ValidationMethodName
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Obsession::Rails::ValidationMethodName
- Defined in:
- lib/rubocop/cop/obsession/rails/validation_method_name.rb
Overview
This cop checks for validation methods that do not start with ‘validate_`.
Constant Summary collapse
- MSG =
'Prefix custom validation method with validate_'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
23 24 25 26 27 |
# File 'lib/rubocop/cop/obsession/rails/validation_method_name.rb', line 23 def on_send(node) on_validate_callback(node) do |method_name| add_offense(node) if !method_name.start_with?('validate_') end end |