-
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
Adds option to track uncovered source files. #422
Adds option to track uncovered source files. #422
Conversation
@@ -49,11 +49,44 @@ def start(profile = nil, &block) | |||
end | |||
|
|||
# | |||
# Finds files that were to be tracked but were not covered and initializes | |||
# their coverage to zero, with an estimation of the line count. |
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.
s/covered/loaded
Looks like this is just about ready - a typo remains. I'm not sure whether the discussion about |
I'll apply the suggestion to mark the whole file as uncovered, instead of having a function to validate the lines (and fix the typo). |
Added a configuration option `track_files` that accepts a glob. With this enabled, coverage result will include uncovered files that match the glob. In the `rails` profile this is set to `{app,lib}/**/*.rb`
b48311f
to
81e2431
Compare
The builds are failing due to unrelated issues which are fixed in #425, by @xaviershay. |
Added some method documentation and merged. Thank you! I'll include this in 0.11. |
0.11.0 2015-11-29 ([changes](simplecov-ruby/simplecov@v0.10.0...v0.10.11)) ================= ## Enhancements * Added `SimpleCov.minimum_coverage_by_file` for per-file coverage thresholds. See [#392](simplecov-ruby/simplecov#392) (thanks @ptashman) * Added `track_files` configuration option to specify a glob to always include in coverage results, whether or not those files are required. See [#422](simplecov-ruby/simplecov#422) (thanks @hugopeixoto) * Speed up `root_filter` by an order of magnitude. See [#396](simplecov-ruby/simplecov#396) (thanks @raszi) ## Bugfixes * Fix warning about global variable `$ERROR_INFO`. See [#400](simplecov-ruby/simplecov#400) (thanks @amatsuda) * Actually recurse upward looking for `.simplecov`, as claimed by the documentation, rather than only the working directory. See [#423](simplecov-ruby/simplecov#423) (thanks @alexdowad)
This seems a really useful feature for finding unused code – worth highlighting in the README? |
Hi @andyw8
|
@ClaudioCarmeli I think he meant because it finds even files that aren't even required --> those can probably be deleted or something in the setup is wrong/incomplete |
Yes, that's what I was thinking of. |
Fixes #413
Added a configuration option
track_files
that acceptsa glob. With this enabled, coverage result will include
uncovered files that match the glob.
In the
rails
profile this is set to{app,lib}/**/*.rb
Regarding line count issue:
It is not easy to determine which lines should be classified as relevant (this is done by the ruby parser), so this implementation does not touch the coverage information for covered files, to avoid ruining the accurate percentages.
When handling uncovered files it uses an approximation function to determine if the line is relevant or not, based on the code present in #16. As uncovered files have 0% coverage, this will only affect the global percentage, so I don't think it's an issue.