[TypeScript] "comment density": first lines of file not counted?

We are scanning our TypeScript projects with SonarQube 7.9 LTS.

We set the minimum threshold of comment density to 15%. But we seem to have false-positives when the comment is at the top of the file. We do not use licence headers in our source code.

The rule is this one : /coding_rules?languages=ts&open=common-ts%3AInsufficientCommentDensity

Is there a way to fix this? Is Sonarqube expecting a licence header? If so, can we disable this expectation?


Hello @placaze,

Thank you for your message, and welcome to our community!

SonarJS ignores by default every top-level header for any source file. You can change this behaviour by setting the sonar.javascript.ignoreHeaderComments property to false.

Hope this helps,