Skip to content
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

Let amend_coverage_from_src! skip partially covered code (WIP) #188

Closed

Conversation

fingolfin
Copy link
Member

This is meant to fix issue #187, or at least reduce the problem, by not applying amend_coverage_from_src! to functions which already have some coverage information, based on the idea that those functions were executed by Julia, and the coverage information therein then should just be "trusted".

There are various issues with this in its current state, but I don't have more time right now to tune it, so I though it's better to post this now in case people like @ronisbr or @tkoolen are interested in giving it a spin.

Among the problems are:

  • this does not yet deal properly with modules: Meta.parse will read a whole module in one go; but then unused functions in that module are not marked as code again. So the code needs to be refined to look inside modules, and then iterate over the functions therein. In fact it probably needs to traverse the whole AST and treat each function separately, to also deal with nested functions. Ho-hum. It would be really nice if we didn't have to do any of this, and Julia just did the "right thing" for functions that are never executed (whatever that means exactly...)

Example: src/Coverage.jl from this package with master resp. 0.7.0 vs. with this PR

Note that both of these issues of course would also appear if amend_coverage_from_src! was simply removed.

On the plus side, I suspect that e.g. the example by @tkooolen for coverage in StaticArrays.jl/src/eigen.jl will look a lot better, because a lot of the red lines will turn into gray/white (= "not code") again.

I can try to see if things can be improved, but I'll have to learn how the AST returned by Meta.parse works... If somebody more knowledgeable than me on these things (e.g. some actual Julia developers) wants to take over, be my guest ;-).

@codecov-io
Copy link

codecov-io commented Oct 31, 2018

Codecov Report

Merging #188 into master will increase coverage by 9.18%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #188      +/-   ##
==========================================
+ Coverage   80.18%   89.36%   +9.18%     
==========================================
  Files           6        6              
  Lines         333      301      -32     
==========================================
+ Hits          267      269       +2     
+ Misses         66       32      -34
Impacted Files Coverage Δ
src/Coverage.jl 97.91% <75%> (+11.12%) ⬆️
src/codecovio.jl 95.08% <0%> (+5.85%) ⬆️
src/lcov.jl 100% <0%> (+13.2%) ⬆️
src/coveralls.jl 72.91% <0%> (+13.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc69585...6dfd139. Read the comment docs.

@fingolfin
Copy link
Member Author

I've now attempted the improved workaround I sketched above in PR #210.

@fingolfin fingolfin deleted the mh/skip-partially-covered-code branch March 14, 2019 14:15
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.

2 participants