Class: RuboCop::Cop::Codeur::RailsAvoidInstanceMethodsInHelpers
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Codeur::RailsAvoidInstanceMethodsInHelpers
- Defined in:
- lib/rubocop/cop/codeur/rails_avoid_instance_methods_in_helpers.rb
Overview
This cop makes sure that Rails helpers only uses class methods in order to be able to use them in the test, views or from anywhere else. ApplicationHelper is excluded from this rule by default.
Constant Summary collapse
- MSG =
'Prefer class methods in helpers.'
Instance Method Summary collapse
Instance Method Details
#on_def(node) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/rubocop/cop/codeur/rails_avoid_instance_methods_in_helpers.rb', line 28 def on_def(node) # NOTE: :sclass node is a "class << self" node return if node.parent.sclass_type? add_offense(node) end |