Skip to content

Conversation

@KminekMatej
Copy link
Contributor

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->statements to 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.

These lines are correctly represented by <line> xml tag, but should be counted amongst the coverage/project/metrics, affecting statements / coveredStatements metrics
@KminekMatej
Copy link
Contributor Author

Checks are failing on issues clearly independent to my updates.

HTTPAssertTest is getting improper response from httpbin, often its just 502 HTTP response code.

Checks related to PHPDBG are failing on weird issues, but looking into history these issues sometimes occurs even on @dg or @JanTvrdik commits. I dont think fixing these checks should be part of this PR, am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Work with lines outside class/struct in Clover XML report

1 participant