Skip to content

Conversation

@jkuchar
Copy link
Contributor

@jkuchar jkuchar commented Aug 29, 2015

Source files that was not loaded when executing tests was not counted to coverage. This produces false results.

I've added estimator of executable lines. What do you think about this prototype? I'm not sure about duplicating code between CloverXMLGenerator and HtmlGenerator. PhpParser can provide quite accurate data for estimate of lines that can be estimated.

@milo
Copy link
Member

milo commented Aug 31, 2015

Imho, estimation can be more rough. It never will be precise anyway. What about only removing empty lines and count the rest? It will be very pessimistic, but imho OK for this purpose.

@jkuchar
Copy link
Contributor Author

jkuchar commented Aug 31, 2015

I've done exactly this in first prototype. Removing comment blocks and counting lines gives ~2x times more lines then this filtered version. This gives developer motivation to have at least some test for each file. Because even loading that file will increase coverage. :) Do you like counting lines with PhpParser more or with regex I've proposed?

Or what about counting only functions/methods lines count returned by PhpParser?

@milo
Copy link
Member

milo commented Sep 17, 2015

PhpParser is overkill here. Imho, this regexp too (it's not 100% correct). Just remove empty lines, it will be super pessimistic, but who cares in this case.

@jkuchar
Copy link
Contributor Author

jkuchar commented Sep 17, 2015

:+1 (will fix this tomorrow)

@jkuchar jkuchar force-pushed the fix-include-all-src-files-into-coverage branch 2 times, most recently from 28b2795 to 09a4a3d Compare October 21, 2015 17:59
@jkuchar
Copy link
Contributor Author

jkuchar commented Oct 21, 2015

@milo fixed and rebased onto master

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work with \r\n. What about count(file($file, FILE_SKIP_EMPTY_LINES))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I didn't know about that one. Fixed in cebe26d

@jkuchar jkuchar force-pushed the fix-include-all-src-files-into-coverage branch 2 times, most recently from 2b6cf06 to cebe26d Compare October 21, 2015 19:15
@jkuchar jkuchar force-pushed the fix-include-all-src-files-into-coverage branch from cebe26d to 3815b58 Compare October 22, 2015 14:53
@jkuchar
Copy link
Contributor Author

jkuchar commented Oct 22, 2015

@dg removed comment

@jkuchar
Copy link
Contributor Author

jkuchar commented Nov 14, 2015

@milo is there anything more to do with this PR?

milo added a commit that referenced this pull request Nov 14, 2015
…overage

HtmlGenerator: Not loaded source files was not counted to coverage
@milo milo merged commit 5f7a775 into nette:master Nov 14, 2015
@milo
Copy link
Member

milo commented Nov 14, 2015

Thank you. I missed the renewed commit.

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.

3 participants