Developer Edition Version 9.2.4
SonarQube is reporting lots of duplicate blocks for ‘require’ statements in .js files.
Is there a way to tell SQ to ignore requires statements when reporting duplicate blocks?
I searched through a bunch of Q&A both here and in StackOverflow and I read through the doc on “narrowing the focus” but I can’t find a way to apply the rule to the remainder of the files apart from the require statements.
I see that Import considered as duplicated lines in SonarQube reported a similar issue for import statements in typescript files and that a ticket was opened for that. Should a similar enhancement request be opened for this?
I would hope that a generic solution would be implemented. I am surprised that this is still a problem given the number of people who have hit the issue over the past number of years.
Adding a rider about how to ignore duplicate comments.
Each module begins with a common copyright header, followed by the require statements.
The copyright date must be updated when a module is edited and the copyright comment block is often part of a duplicate block, so the PR gets a high duplication score. This prevents the code duplication metric being used as a Quality Gates.
thanks, /Dave.