-
Notifications
You must be signed in to change notification settings - Fork 553
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
All Files hits/lines value appears to be improperly weighted #179
Comments
Yeah, I noticed this as well. As an example, I have three controllers: application_controller.rb The application controller is empty except for the The total says that the controllers are covered at 3.53 hits per line -- (4.8+4.8+1)/3 = 3.53 It should be (4.8 * 40 + 4.8 * 40 + 1.0 * 2)/(40+40+2) = 4.7 hits per line |
It looks like the problem is with the covered_strength method on line 40 of lib/simplecov/file_list.rb I'll fork and fix it. |
Pull Request: #192 |
Thanks @Graysonwright, this should be resolved now as part of the 0.8.0 release, which ships today. |
Awesome, thanks! Good work! |
It appears that while the All Files %coverage value is properly calculated by summing the lines covered and dividing by the sum of the relevant lines, the All Files hits/line value is simply an average of the per-file Avg. Hits / Line value. If you have a file with very few relevant lines and high Avg. Hits / Line, this can result in a spurious value. A more accurate way of calculating this value would be to calculate the hits for each file by multiplying the per-file Avg. Hits / Line by the per-file Relevant Lines, summing those values, and then dividing by the sum of the relevant lines.
The text was updated successfully, but these errors were encountered: