Js:S1451, Track lack of copyright and license headers, how to resolve it?

Sonarqubes: 10.6

  • 10.6 zip
  • I am trying to resolve the error " add or update the license header."
  • I tried to comment on the header on the first line, but it threw the error, and when I commented on the header on the second line, the error was gone.
    shouldn’t the comment be on 1st line?
    I am using a default rule… no parameters changed!

Please let me know why. I should leave the 1st line empty?

Issue resolved when i put the same comment in headerformat in parameters . :sunglasses: and i just need to keep all comments same in all files.

1 Like

Hi,

I’m glad you worked through this.

Would you mind sharing the rule parameter? I’m trying to figure out why the issue wasn’t raised when the comment started on line 2.

 
Thx,
Ann


Before, I was using default rule parameters (I tried again… it’s the same situation; the violation is not showing up) …

Hi,

Can you share the text of the parameter you’re using?

 
Thx,
Ann

/**
* Copyright (c) 2025 ] *
* testheadercommentrule m Licensed under the * License
*/

I replaced the comment in the headerformat field. (the above one is just an example)

Hi,

I’ve edited your post to add code formatting (``` on the line before and on the line after) to make sure we all see what we should here.

Could you verify it looks right to you and could you post the text of your comment. Sorry to ask. I know it’s in your initial screenshots, but it will be useful to have the exact text.

 
Thx,
Ann