Class: RuboCop::Cop::GreppableRails::NoIncludeInHelper
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::GreppableRails::NoIncludeInHelper
- Defined in:
- lib/rubocop/cop/greppable_rails/no_include_in_helper.rb
Overview
Prohibits include inside helper modules. Including makes it hard
to grep where a helper method actually lives, and broadens the
constant-dependency surface so that changes to one helper become
unpredictably visible from another.
Constant Summary collapse
- MSG =
"Do not include in Helper."- RESTRICT_ON_SEND =
%i[include].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/rubocop/cop/greppable_rails/no_include_in_helper.rb', line 46 def on_send(node) parent = node.parent parent = parent.parent if parent&.begin_type? return unless parent&.module_type? return unless parent.identifier.const_name.end_with?("Helper") add_offense(node) if render_with_inline_option?(node) end |