Tell us:
- What language is this for?
C# / CSHTML / Razor
- Which rule?
Web:S6836 : label elements should have a text label and an associated control
- Why do you believe it’s a false-positive/false-negative?
Code (see below) contains additional elements. This is in accordance with the rule description which states:
HTML static code analysis
Custom components may contain control elements, therefore label elements containing custom elements do not raise issues.
(this is typical where you have label>checkbox)
- Are you using
- SonarQube Server
2025.4
- How can we reproduce the problem?
<label>@Html.RadioButtonFor(model => model.AllOptions, true, new { id = "AllOptions_True" }) All Options</label>
the label contains a Razor radio button, so matches the exception detailed in the documentation