Class: RuboCop::Cop::RailsAccessibility::ImageHasAlt
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::RailsAccessibility::ImageHasAlt
- Defined in:
- lib/rubocop/cop/rails_accessibility/image_has_alt.rb
Constant Summary collapse
- MSG =
"Images should have an alt prop with meaningful text or an empty string for decorative images"
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/cop/rails_accessibility/image_has_alt.rb', line 13 def on_send(node) receiver, method_name, = *node return unless receiver.nil? && method_name == :image_tag alt = has_alt_attribute?(node) add_offense(node.loc.selector) if alt.nil? end |