I have a scenario where there is an AEM template file and in this file, I have a single <li>
element. In other words, I have a loop inside that generate a list of items.
<template data-sly-template.step>
<li
data-sly-use.localStep="MyAdapter"
data-sly-test="${(wcmmode.edit && localStep.start) || !wcmmode.edit}"
But, the Sonar's rule RSPEC-1093 is complaining that:
"<li>"
and"<dt>"
item tags should be in"<ul>"
,"<ol>"
or"<dl>"
container tags.
In this case, is not a bug, once that the <ul>
is outside of the template. The output file is a well-generated HTML file with no errors.
I'm trying to use NOSONAR
in html file. I have tried <!-- NOSONAR -->
and <!-- //NOSONAR -->
, but is not working.
How can I mark this line in HTML file to be ignored by sonar rules?
I checked the SonarHTML plugin source code and for my understanding you have to add //NOSONAR
at the line which should be ignored. In your case it should be:
<template data-sly-template.step>
<!-- //NOSONAR --><li
data-sly-use.localStep="MyAdapter"
data-sly-test="${(wcmmode.edit && localStep.start) || !wcmmode.edit}"
If you compress the source code then the solution is safe to use. If not, you have to be aware that all those <!-- //NOSONAR -->
will be send to your client. It means that the resources usage will be bigger (for example network bandwidth - more bytes to send).
The //NOSONAR
is handled by org.sonar.plugins.html.visitor.NoSonarScanner
:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With