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

Stop polluting ::Array and ::Hash #449

Merged
merged 1 commit into from
Jan 20, 2016

Conversation

amatsuda
Copy link
Member

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.

@colszowka
Copy link
Collaborator

The build failed because of Rubycop, there is #448 for that.

@colszowka
Copy link
Collaborator

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?

@amatsuda
Copy link
Member Author

@colszowka

We still need to remove the actual includes from the source

I believe that was actually included in the previous commit, and at least the specs and features were passing locally with that changeset!

@colszowka
Copy link
Collaborator

I'm an incapable of reading diffs it seems. Thanks! Merging! I also created #450 for the followup work

colszowka added a commit that referenced this pull request Jan 20, 2016
Stop polluting ::Array and ::Hash
@colszowka colszowka merged commit dd2f7c1 into simplecov-ruby:master Jan 20, 2016
@colszowka
Copy link
Collaborator

Lol, awesome branch naming 🐵 🔫

colszowka added a commit that referenced this pull request Jan 20, 2016
craiglittle pushed a commit to craiglittle/simplecov that referenced this pull request Feb 13, 2016
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Feb 17, 2016
## 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)
@amatsuda amatsuda deleted the 🐵🔫 branch April 7, 2016 23:52
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.

None yet

2 participants