Class: RuboCop::Cop::Heatwave::RedundantHelpersFaIcon
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Heatwave::RedundantHelpersFaIcon
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/heatwave/redundant_helpers_fa_icon.rb
Overview
Flags helpers.fa_icon(…) calls in views, components, and helpers.
fa_icon is delegated onto ViewComponent::Base (see
config/initializers/view_component_icon_helpers.rb) and is part of
ApplicationHelper, so the helpers. proxy is always redundant in
render contexts. Keeping it adds noise and makes ViewComponent
templates harder to scan.
Constant Summary collapse
- MSG =
'Use bare `fa_icon` instead of `helpers.fa_icon` — it is ' \ 'available on every component and view.'
- TARGET_REGEX =
Match the
helpers.(orhelpers&.) prefix immediately before
fa_icon. Allow leading whitespace /(/[/,/=so we
don't accidentally rewritemy_helpers.fa_icon(different receiver). /(?<![A-Za-z0-9_])helpers\s*&?\.\s*(fa_icon)\b/
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
30 31 32 |
# File 'lib/rubocop/cop/heatwave/redundant_helpers_fa_icon.rb', line 30 def on_new_investigation scan_source end |
#on_other_file ⇒ Object
34 35 36 |
# File 'lib/rubocop/cop/heatwave/redundant_helpers_fa_icon.rb', line 34 def on_other_file scan_source end |