S6853 Triggers on .NET MVC Razor cshtml files

  • What language is this for? HTML
  • Which rule? S6853
  • Why do you believe it’s a false-positive/false-negative? asp-for should be treated a valid way of associating a form label with a control. When the field is generated it has a for attribute.
  • Are you using
    • SonarQube Cloud?
    • SonarQube Server / Community Build - which version? Enterprise Edition v10.8.1
    • SonarQube for IDE - which IDE/version?
      • in connected mode with SonarQube Server / Community Build or SonarQube Cloud?
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)

Create a cshtml file with:

<label asp-for="SubmittersComments"></label>
<textarea asp-for="SubmittersComments"></textarea>

Hey there.

Thanks for the feedback! We already have an open ticket for this issue here: SONARHTML-218

I’ll link this thread to that ticket.