Class: RuboCop::Cop::Migrations::IconButtonComponent
- Inherits:
-
Cop
- Object
- Cop
- RuboCop::Cop::Migrations::IconButtonComponent
- Defined in:
- lib/primer/view_components/linters/migrations/iconbutton_component.rb
Overview
Lint and autocorrect deprecated IconButton
Constant Summary collapse
- INVALID_MESSAGE =
<<~STR `Primer::IconButton` is deprecated. Please use `Primer::Beta::IconButton` instead. STR
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/primer/view_components/linters/migrations/iconbutton_component.rb', line 26 def autocorrect(node) return if hash_with_box_value?(node.arguments.first) lambda do |corrector| corrector.replace((node), "Primer::Beta::IconButton") end end |
#on_send(node) ⇒ Object
20 21 22 23 24 |
# File 'lib/primer/view_components/linters/migrations/iconbutton_component.rb', line 20 def on_send(node) return unless (node) add_offense(node, message: INVALID_MESSAGE) end |