Sonarcloud is including curly braces, empty lines and import lines for coverage

We are using sonarcloud for our open source project, for nodejs sonar cloud is including curly braces, empty lines and import lines for coverage becaue of that we are getting less coverage and it blocked quality gate.

In this query link, they mentioned that sonar cloud will exclude all curly braces and empty line. But it is including here.

Here is the link for sonar cloud.

Please help why it is happening like this.


Seeing the result of your PR on SonarCloud it seems that the exclusion of empty lines and curly braces is working well.

The result says that you have 10 lines to cover and when I head to one of your file I can see that there are indeed some uncovered lines, like here:

You need to cover the yellow lines that have a red block on the left to increase the coverage of your PR. Lines with a green block are already covered and those that don’t have a colored block are lines that are ignored, like the curly braces on the screenshot.

Thanks for the response @Gregoire_Aubert
If you see this file the line numbers 1-10 (import modules), 69-70, 77, 86, 116, 165-166, 169-170 includes empty lines and braces.

Mmmh indeed, I hadn’t notice this… Do those lines appear in the coverage report that is imported by SonarCloud ? Does the the coverage report says those lines are uncovered ?

yes @Gregoire_Aubert it includes in coverage because of that we forcing some PR merge since we don’t have any solution.

Any update on this? @Gregoire_Aubert @TomVanBraband can you please help us with this.

What tool do you use to compute the coverage ?
Because on our side we read it from the report generated by your tool, and that’s what gives us which line is covered or not. We don’t compute coverage on our side.

So if those lines are really reported by your tool saying they need to be covered, I’m not sure we can do much.