-
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
Stop polluting ::Array and ::Hash #449
The head ref may contain hidden characters: "\u{1F435}\u{1F52B}"
Conversation
The build failed because of Rubycop, there is #448 for that. |
As to the actual topic: I totally agree with you, we must stop doing this, thanks for pointing it out! We still need to remove the actual includes from the source https://github.com/colszowka/simplecov/blob/master/lib/simplecov/merge_helpers.rb#L37-L38 - would you mind doing this? I would expect that with the existing changes this should keep working? |
I believe that was actually included in the previous commit, and at least the specs and features were passing locally with that changeset! |
I'm an incapable of reading diffs it seems. Thanks! Merging! I also created #450 for the followup work |
Stop polluting ::Array and ::Hash
Lol, awesome branch naming 🐵 🔫 |
## Enhancements ## Bugfixes 0.11.2 2016-02-03 ([changes](simplecov-ruby/simplecov@v0.11.1...v0.11.2)) ================= ## Enhancements * Do not globally pollute Array and Hash with `merge_resultset` utility methods. See [#449](simplecov-ruby/simplecov#449) (thanks @amatsuda) * Do not `mkdir_p` the `coverage_path` on every access of the method (See [#453](simplecov-ruby/simplecov#453) (thanks @paddor) * Fixes a Ruby warning related to the `track_files` configuration. See [#447](simplecov-ruby/simplecov#447) (thanks @craiglittle) * Add a group for background jobs to default Rails profile. See [#442](simplecov-ruby/simplecov#442) (thanks @stve) ## Bugfixes * Fix root_filter evaluates SimpleCov.root before initialization. See [#437](simplecov-ruby/simplecov#437) (thanks @tmtm)
Requiring simlpecov globally adds the
merge_resultset
method to the built-in Array class and Hash class via monkey-patching, which means this gem widely changes the test subject's behavior.Such a horrible vandalism should never be done by a test coverage measurement tool. We should immediately stop doing this.
I suppose the same merging logic could be more safely and cleanly implemented by two or three static methods instead of extending the core classes, but for now, I'd suggest a patch that changes the Result class to dynamically extend the result objects using the existing Modules.
This way we would be able to minimize the conflict with other PRs working on the merging_helpers e.g. #436 and #441.