Apex coverage number doesn't match Salesforce's numbers

For Apex code, test coverage in Salesforce and SonarQube are not matching eventhough number of lines are matching, but percentage is not correct.
We are getting only 28% whereas its 75% covered. Total number of lines are around 150k.
Is there any limitation on total number of lines or total number of lines in Single File ?
Are there any open bugs with Apex code test coverage ? Is anyone else also facing this issue ?

Hi,

Welcome to the community!

I’ve moved your post to a new thread since it’s tangential to the guide you originally posted on.

This is likely due to executable lines. This dusty-but-still-relevant blog post should help.

 
Ann

Hi Ann,

Thanks for the blog-post, Although it was not relevant but useful.
We are facing issues in Apex code, a file which has 90% coverage in Salesforce has just 10% in SonarQube.
The Total number of lines in tests/apex/test-result-codecoverage.json is quite high, it seems some of the lines are getting ignored.

Hi,

We go literally by what the coverage report says.

Can you double-check the report you pass into SonarQube to make sure it says your 90% file is actually 90%?

 
Ann