-
Notifications
You must be signed in to change notification settings - Fork 550
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
Comment lines in unloaded files are marked as uncovered #433
Comments
yeah that's weird, I wouldn't have expected that to change. I'll have to go back through commits to figure it out. |
@kmewhort Would you like to submit a failing test for us? It should be pretty easy to identify it with a simple git bisect. Also, which Ruby are you on, and which profile/config are you running? (Does changing the method invocation |
I was having some trouble reproducing this in a simplified failure-case spec -- and it turns out the issue is a bit more subtle than the one I first stated. The actual issue is that files with 0% coverage report ALL lines as missed, not just the relevant lines. In my particular case, my specs hit 100% coverage for Looks like the likely culprit is 81e2431. |
Thanks @kmewhort , the "double run" scenario sounds like enough for us to track it down. @hugopeixoto any thoughts on how we might address this? |
If someone needs a quick workaround, setting It seems that it is the merging process that's causing the problem. The coverage from each run probably look something like this:
When merging these two coverage arrays, the nils have the lowest precedence, so the final coverage is
I'm not sure if there's a reason why nil is overridden. Since An alternative would be to change the json format to explicitly mention unloaded files, but that might be a bit trickier. I'm submitting a PR with a test case for this, and I'll add a commit with the nil precedence changed so you can try this out. |
Merging {0,nil} to nil seems like maybe a bit of a workaround, without resolving the primary issue here. This would fix merges using the merge_helper...but not, for example, merges by an external merge tool. I think the primary issue here is that a Is there any reason that the same filter used for covered files couldn't be run against these untracked files (so as to not report comment lines)? Would this be too much of a performance hit? |
@kmewhort the problem is that there's no explicit filter. |
Ah, I see. Darn, looks like there's no easy way to accurately report only the executable lines in these uncovered files then. |
I think I ran into this exact problem, and the fix was actually rather simple. See this: #444 Disclaimer: I have not tested this except in my own environment and on my own project. My truth-table work gives me confidence that this fix indeed works, but I might be overlooking something. |
@ksmurphy That sounds like what my proposed PR actually does. |
The original logic would overwrite a nil with a 0 unless both result arrays had nils, resulting in red. But since a nil signifies a no-op line, a nil should always be replaced with a nil. Thus changing '&&' to '||' fixed it for me. I'm not sure what was in your PR, but did you make the same minor code change? |
Is this affected by #441 ? |
Is this still an issue for anyone? Need to retest this and see if it was/is fixed (which I hope) |
Closing due to missing feedback |
In version 0.10, the additional lines on mult-iline statements, as well as comments, were ignored -- which seems like the correct behaviour. In version 0.11, these lines are marked as not covered.
Before and after:
![simplecov_0 10](https://cloud.githubusercontent.com/assets/402654/11548041/7e7fdefe-990d-11e5-937b-c95c118669b3.png)
![simplecov_0 11](https://cloud.githubusercontent.com/assets/402654/11548044/82820f9a-990d-11e5-8008-b7515092e58c.png)
The text was updated successfully, but these errors were encountered: