I have noticed the total coverage doesn’t increase even after exclude un covered lines.
What I have noticed after exclusions was, after exclusions the number of Lines to cover and Uncovered Lines both got reduced. So looks like that impact the total coverage remain same.
Further after exclusions those files DO NOT appear under files as expected which confirms exclusions working properly.
Can someone please explain what’s the theory behind and how exclusions can increase the total coverage
What sort of more details will help. As mentioned all the exclusions, has been removed from the Sonar side. I assume that implies data transfer from Project to Sonar is good.
Further does this can happen due to configuration issue on Sonar portal side?.
In theory to increase the Total coverage with eclusions, ONLY "Uncovered Lines" number should reduce after exclusions.
I see you’ve edited your OP to include some screenshots. That’s helpful. Can you also show before/after Lines of Code? Also, is it possible you excluded some code that was covered? That could certainly explain your coverage dropping.
And finally, your followup post includes your analysis command. Cool. I notice you’ve pinned in it the version of the analyzer which is less cool. You’re 2 major versions behind & this is why we advise against pinning the version. Drop that & it should automatically use the latest/greatest.
I should have been more precise. You’re rebuilding after the begin command and before the end command?
For Lines of Code, you’ve given screenshots of coverage before and after the exclusions. I’m looking for similar screenshots that show the Lines of Code metrics.
I’m not sure my question is answered. You excluded some code. Was any of the excluded code covered by tests?
I was hoping for the same kind of before/after screenshots that you provided for coverage metrics. You see, I’m wondering about the math here. From your initial screenshots, I see that
Before exclusions you had
34,637 lines to cover
26,857 uncovered lines
7780 covered lines (via math)
After exclusions you had
31,808 lines to cover
25,169 uncovered lines
6639 covered lines (math)
So it seems that your exclusions dropped some covered lines. If I do a straight percentage (6639/31808*100) that comes out to 20.9%. But our coverage percentage isn’t based only on lines. It also takes into account conditions. I’ll let you review the formula but I think I’m back to my initial supposition: your exclusions eliminated enough covered code to drop the percentage.