-
-
Notifications
You must be signed in to change notification settings - Fork 73
HtmlGenerator: Not loaded source files was not counted to coverage #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HtmlGenerator: Not loaded source files was not counted to coverage #248
Conversation
|
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. |
|
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? |
|
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. |
|
:+1 (will fix this tomorrow) |
28b2795 to
09a4a3d
Compare
|
@milo fixed and rebased onto master |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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
2b6cf06 to
cebe26d
Compare
cebe26d to
3815b58
Compare
|
@dg removed comment |
|
@milo is there anything more to do with this PR? |
…overage HtmlGenerator: Not loaded source files was not counted to coverage
|
Thank you. I missed the renewed commit. |
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.