Alt property in Angular

Hi guys,

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Version 6.7.1 (build 35068)
    Quality profile Sonar way recommended
    Framework: Angular 6.0.9
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
    “Images tags and buttons should have an alt attribute” warning occurs when alt is used in property bindings in template ([alt]=”expression”).
  • steps to reproduce
  1. Add property binding for alt in template
    Actual result: warning with “add an alt attribute to this image” occurs
    Expected result: No warnings occur

Hi @ubcent

Thank you for your feedback.

It makes indeed sense to support Angular’s property binding syntax.
I created the following ticket: https://jira.sonarsource.com/browse/SONARHTML-92. The rule you mention is listed there as RSPEC-1077.

Best regards,

-Nicolas

Should it not also handle [attr.alt] ?

Hi @C0ZEN and welcome to the community,

Thank you for reporting this issue. We are aware of this problem. If you want you can track the corresponding ticket.

Please create a separate topic next time. The ticket related to this topic has been fixed. That way we can track more easily when there is a new bug.

Cheers,
Nicolas