When I run tests, I get a clover.xml file that contains tags and attributes like this:
<metrics conditionals="664" methods="117" classes="13" files="9" packages="1" coveredstatements="1554" complexity="710" loc="3620" ncloc="3203" coveredmethods="105" coveredconditionals="479" statements="1989" coveredelements="2138" elements="2770"/>
Among the attributes, we find methods and coveredmethods, statements and coveredstatements, ...
I'm interested in number of code lines, and the number of covered code lines.
Is there a way to have them in clover.xml, preferably in the same metrics tag?
Thanks in advance..
"3620" is the number for Lines Of Code.
I think that ncloc
"3203" is the number for N
on-Comment Lines of Code as per https://confluence.atlassian.com/display/CLOVER/clover-report
Actually there is no point in "Covered Lines of Code" number. "Covered Statements" is very well describing the coverage.
There are 3620 lines of code. Comments and empty lines cannot be covered so we can only consider lines with the real code to cover.
You have 1989 statements. Some of them probably span multiple lines so let's assume there are 2000 lines of code containing statements.
Next let's assume that all your code is covered (all 1989 statemetns and thus all 2000 lines). It means that your code is fully covered (1989 statements in total / 1989 statements covered = 100%). This is very good existing metric.
On the other hand there are: 2000 lines with code covered / 3620 lines in total = 55%. If you add more comments or empty lines (e.g. licensing information) then the number will drop below 55% while still all your code will be covered.
This 55% simply says nothing.
In order to make it reasonable we would need to find "number of lines containing statements" and compare with "number of covered lines containing statements" to get meaningfull 100% - but this is actually duplicate of what we have now: number of statements and number of covered statements.
Does this answer your question?
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork? We've compiled a list here, along with...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs