Based on RSPEC-5254, SonarLInt claims that the following code is non-compliant:
<!DOCTYPE html> <html> <head> <title lang="en">SonarLint Test File</title> </head> <body lang="en">
The error message provided by SonarLint only goes away if
htmlelement is given a
htmlstart tag is removed (since that tag is optional, even though I don’t know whether the Sonar developers are aware of this).
Note that if a
lang attribute is present on the
body, screen readers will pronounce the page content in that language, regardless of whether the
html start tag has a different
lang attribute value or no
lang attribute at all.
(Even though I am using SonarLint in VS Code, I assume this issue applies to all Sonar products that implement this rule.)