Hi, we are using SonarCloud and SonarLint for our Django/Jinja2 framework. Jinja2 uses lots of imports to build web pages, so often a page on its own will not have compliant HTML. For example, we might import the header to a table from a different file if it is repeated a lot.
We therefore get hundreds of errors because SonarCloud and SonarLint only read the file in isolation. Is there any way for it to parse the HTML as if the imports were made?
Just to be sure I understand correctly, you are using jinja import statements to import macros and you get issues on your HTML code because it is syntactically not correct without executing these macros. Is that it?
Could you share some code and the rules which raise False Positives?
Results in SonarCloud flagging a “major bug” Web:S5256 as tables should have headers. It does not read that the _tablehead.html includes a header so the table would pass this test when compiled.
Sadly the HTML analyzer can’t resolve includes.
I would recommend to disable the rules which raise False Positives in your case. You can do this by creating your own Quality Profile for HTML.
Could you provide the list of rules which raise False Positives because of include? I’ll create a False Positive ticket. We could detect that include is used and disable the rule automatically these rules.