False positive for S5256 - Tables should have headers

SonarQube version: 9.2.4 Community Edition
Rule: Web:S5256 - Tables should have headers

Code: This is inside a .NET 6 MVC *.cshtml file

<table>
   <thead>
    <tr>
      @{
        for (int i=0; i < Model.Label.Count; i++) {
          <th>@Model.Label[i].name</th>        
        }
      }
    </tr>
  </thead>
...

SonarQube does not see the elements inside the for loop, and raises S5256 as a major bug because of supposedly missing table headers.

Hello Chris,

Thank you very much for the reporting this. I did create the SONARHTML-154 ticket to track this.
Unfortunately, we do not have an estimate time yet on when we are going to work on this.

Best,
Karim.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.