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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/simplecov/defaults.rb
Expand Up @@ -4,8 +4,9 @@

SimpleCov.profiles.define "root_filter" do
# Exclude all files outside of simplecov root
root_filter = /\A#{Regexp.escape(SimpleCov.root)}/io
root_filter = nil
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 ❤️

end
end
Expand Down