Class: RuboCop::Cop::Obsession::Rails::ValidateOneField
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Obsession::Rails::ValidateOneField
- Defined in:
- lib/rubocop/cop/obsession/rails/validate_one_field.rb
Overview
This cop checks for ‘validates` callbacks with multiple fields.
One field per ‘validates` makes the validation extra clear.
Constant Summary collapse
- MSG =
'Validate only one field per line.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
26 27 28 |
# File 'lib/rubocop/cop/obsession/rails/validate_one_field.rb', line 26 def on_send(node) add_offense(node) if validates_with_more_than_one_field?(node) end |