Skip to content

HtmlGenerator: Not loaded source files was not counted to coverage - #248

Merged
milo merged 1 commit into
nette:masterfrom
jkuchar:fix-include-all-src-files-into-coverage
Nov 14, 2015
Merged

HtmlGenerator: Not loaded source files was not counted to coverage#248
milo merged 1 commit into
nette:masterfrom
jkuchar:fix-include-all-src-files-into-coverage

Conversation

@jkuchar

@jkuchar jkuchar commented Aug 29, 2015

Copy link
Copy Markdown
Contributor

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

milo commented Aug 31, 2015

Copy link
Copy Markdown
Member

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

jkuchar commented Aug 31, 2015

Copy link
Copy Markdown
Contributor Author

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

milo commented Sep 17, 2015

Copy link
Copy Markdown
Member

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

jkuchar commented Sep 17, 2015

Copy link
Copy Markdown
Contributor Author

:+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

jkuchar commented Oct 21, 2015

Copy link
Copy Markdown
Contributor Author

@milo fixed and rebased onto master

Copy link
Copy Markdown
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
Copy Markdown
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

jkuchar commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

@dg removed comment

@jkuchar

jkuchar commented Nov 14, 2015

Copy link
Copy Markdown
Contributor Author

@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

milo commented Nov 14, 2015

Copy link
Copy Markdown
Member

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