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

Fix root_filter evaluates SimpleCov.root before initialization. #437

Merged
merged 1 commit into from Jan 29, 2016

Conversation

tmtm
Copy link
Contributor

@tmtm tmtm commented Dec 7, 2015

If SimpleCov.root is set to other directory, but root_filter uses current directory.

require 'simplecov'
SimpleCov.root '/other/directory'
obj = Struct.new(:filename).new('/other/directory/test.rb')
p SimpleCov.filters.any?{ |filter| filter.matches? obj }
#=> returns true but it should be false.

add_filter do |src|
root_filter ||= /\A#{Regexp.escape(SimpleCov.root)}/io
!(src.filename =~ root_filter)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s unrelated to this PR, but this could be simplified into src.filename !~ root_filter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right - if you like please send in a PR ❤️

@MikeMcQuaid
Copy link

CC @colszowka for thoughts as we're using a patched version of simplecov in Homebrew to workaround this issue. Thanks for your great work on this gem!

@UniqMartin
Copy link

Just to add a bit more context: This fixes a regression in 0.11.0 and above introduced by #396.

colszowka added a commit that referenced this pull request Jan 29, 2016
Fix root_filter evaluates SimpleCov.root before initialization.
@colszowka colszowka merged commit f4098aa into simplecov-ruby:master Jan 29, 2016
@colszowka
Copy link
Collaborator

Makes sense, thanks!

colszowka added a commit that referenced this pull request Jan 29, 2016
@colszowka
Copy link
Collaborator

@MikeMcQuaid Thank you. We've been collecting a bunch of enhancements and now this bugfix, I'll try to get v0.11.2 out over the weekend - I want to go over the other open PRs and check if we can get those in too. Please complain if it's not out by Monday.

@MikeMcQuaid
Copy link

@colszowka Haha, thanks! The other one we (Homebrew) care about is #436; it'd be great if that (or the patch @bfontaine suggested) could make it in (although I know there's merge conflicts on the PR itself...)

@bfontaine
Copy link

Please complain if it's not out by Monday.

It’s Monday and it’s not out 😄

@colszowka
Copy link
Collaborator

Yip, sorry about that, didn't find the time to properly look into that other pending PR over the weekend since it apparently needs properly reading the source (there is a seemingly legit complaint in there regarding changed behavior)

Either I get that figured out or I'll ship an intermediate 0.11.2 first, then get that sorted and let 0.11.3 follow closely

@bfontaine
Copy link

@colszowka Don’t worry about the time it takes 😃

@colszowka
Copy link
Collaborator

So, 0.11.2 is out now, I'll try to get the merging thing figured out and let a 0.11.3 follow as soon as possible!

@bfontaine
Copy link

Thank you!

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)
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

5 participants