class RuboCop::Cop::Codeur::RailsAvoidInstanceMethodsInHelpers
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.
@example
# bad module CoolHelper def foobar # ... end end # good module CoolHelper def self.foobar # ... end end
Constants
- MSG
Public Instance Methods
on_def(node)
click to toggle source
# 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