Class: RuboCop::Cop::G2::AccessibleIcons
- Inherits:
-
Cop
- Object
- Cop
- RuboCop::Cop::G2::AccessibleIcons
- Defined in:
- lib/rubocop/cop/g2/accessible_icons.rb
Constant Summary collapse
- MSG =
'Make SVGs accessible by either marking them as decorative (`decorative: true`) '\ "or adding a label (`aria_label: t('path.to.description')`)".freeze
- RESTRICT_ON_SEND =
%i(inline_icon).freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rubocop/cop/g2/accessible_icons.rb', line 10 def on_send(node) keyword_args = array_of_kwargs node.arguments return if args_include_decorative?(keyword_args) ^ args_include_aria_label?(keyword_args) add_offense node end |