# What is the standard for a js project comment line?

**URL:** <https://community.sonarsource.com/t/what-is-the-standard-for-a-js-project-comment-line/92279>\
**Category:** SonarQube Server / Community Build\
**Tags:** comments, js\
**Created:** [June 9, 2023, 10:09am UTC](https://community.sonarsource.com/t/what-is-the-standard-for-a-js-project-comment-line/92279 "2023-06-09T10:09:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![honghua](https://avatars.discourse-cdn.com/v4/letter/h/258eb7/32.png) [@honghua](https://community.sonarsource.com/u/honghua)\
**Post date:** [June 9, 2023, 10:09am UTC](https://community.sonarsource.com/t/what-is-the-standard-for-a-js-project-comment-line/92279/1 "2023-06-09T10:09:33Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)  
Enterprise edition 9.9  
SonarScanner 4.6.2.2472

- how is SonarQube deployed: zip, Docker, Helm  
Docker

- what are you trying to achieve  
\*Analyze after comments on different lines

- what have you tried so far to achieve this  
It looks like // comments are recognizable, but not when they appear at the top of the file.

**Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!**

 ![3](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/d/e/de02187c98ea1306a78ce2cc2ba9e1c22d2445df.jpeg)  
 ![4](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/0/5/0522c561a9da9ef6f6759f5c61f23986fa405566.jpeg)

---

<div class="post-metadata">

**Author:** ![Yassin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/yassin/32/36096_2.png) [@Yassin](https://community.sonarsource.com/u/Yassin)\
**Post date:** [June 16, 2023, 5:11pm UTC](https://community.sonarsource.com/t/what-is-the-standard-for-a-js-project-comment-line/92279/4 "2023-06-16T17:11:12Z")

</div>

Hey @honghua,

Thank you for your highly appreciated feedback!

Indeed, as you correctly guessed, the comments at the top of the file are not taken into account for the comment metrics. This is a default behavior of the JavaScript analyzer. The reason is that we assume that every source file generally starts with a license header as a comment. In your case, what’s happening is that line 4 and line 5 are considered to be such a source file header. That’s the reason why the comment count is 4 rather than 6.

Having said that, you can disable this behavior by configuring your SonarQube setup with the property `sonar.javascript.ignoreHeaderComments` set to `false` (default is `true`). Here is where you would do that in SonarQube’s UI:

 ![Screenshot 2023-06-16 at 19.08.15](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/8/1/81308e9585bab38c47668cb22e295a1e3d117911.png)

Hope this helps,  
Yassin

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 23, 2023, 5:16pm UTC](https://community.sonarsource.com/t/what-is-the-standard-for-a-js-project-comment-line/92279/6 "2023-06-23T17:16:19Z")

</div>

Closed on June 23, 2023, 5:16pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
