We are experiencing false positives from ItemTagNotWithinContainerTagCheck from templates (in a framework).
The issue is similar to Ruby HTML views partials <li> issues - #4 by alban.auzeill
There is a corresponding ticket from October 2022 here [SONARHTML-159] - Jira
Seeing this might take some time we want to disable the ItemTagNotWithinContainerTagCheck rule and add a custom one.
For a custom rule we tried using ‘Track lack of required parent elements’: https://rules.sonarsource.com/html/RSPEC-1923/
But this rule only seems to apply to a single parent (cannot find documentation on comma- or space delimited input value).
Is this correct?
We also tried the custom rule ‘Track breaches of an XPath rule’ with which ItemTagNotWithinContainerTagCheck can be implemented and extended just fine. However, the rule applies to XML and cannot be activated in our custom HTML quality profile (where we are able to activate the a custom instance of ‘Track lack of required parent elements’).
Also, when creating a custom rule, is there an easy way to test it?
kind regards
Ron