Version: SonarQube 9.8
Language: HTML (Razor)
Rule: Web:S5256 (tables should have headers)
This rule can be inaccurate when applied to layout pages:
<table>
@RenderSection("tableContent")
</table>
This layout can be used like this:
@section tableContent {
<tr><th>Heading</th></tr>
<tr><td>Content</td></tr>
}
Of course the validity of the generated code depends on how the layout page is used.
This potentially applies to analogous rules in other languages / frameworks.
This is similar to the following reports:
- inverse of Web:ItemTagNotWithinContainerTagCheck - ul and li tags within repeater in asp.net framework
- False positive for S5256 - Tables should have headers
I understand this might not be easy / desirable to fix and these cases can just be marked as ignored.