Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my project I had to manually count code coverage for further reporting. To avoid parsing the code coverage from standard HTML report I wanted to use machine-ready structure so I checked Clover XML output. I expected by dividing
project->metric->coveredStatements / project->metric->statementsto reach the same percents as HTML output has, but surprisingly the number was quite different.During diving into the used algorithm I found out that Clover XML report does not take into account lines which are actually present in the file outside the class / trait scope. Even with a small todo mentioned in comments that it needs to be finished. So I tried to finish it.
During analyzation of the code, there is new function which counts the stats of the lines outside classes / traits and adds these stats into project metrics.
I believe this is smoething to be primarily checked by @milo , who (according to git blame) wrote most of the XML coverage code (big kudos 💪 ).
This PR does not fix the entire percent count completely, as the goal is to count fomr this report same percentil as is reported in the CLI Tester after the tests, but it gets it one step closer to the end.