-
Notifications
You must be signed in to change notification settings - Fork 551
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
"warning: global variable `$ERROR_INFO' not initialized" #400
Conversation
Where is this defined in the first place? Makes me nervous that we're papering over a bigger issue... |
Indeed. I'm sorry that I didn't care about that... I found that
Updated the code to check |
LGTM, not sure why the build is failing :( |
Haven't tracked down deeper yet, but aruba 0.8.x seems broken. |
@@ -47,7 +47,7 @@ | |||
# If we are in a different process than called start, don't interfere. | |||
next if SimpleCov.pid != Process.pid | |||
|
|||
if $ERROR_INFO # was an exception thrown? | |||
if $! # was an exception thrown? |
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.
Perhaps we should instead require 'English'
at the top of the file?
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.
I'm working on another app and got this failure, and it was sufficient to do
$ERROR_INFO ||= $!
if $ERROR_INFO.....
This is important because it is also used below
@exit_status = $ERROR_INFO.is_a?(SystemExit) ? $ERROR_INFO.status : SimpleCov::ExitCodes::EXCEPTION
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.
@bf4 Thank you for the hint! I wasn't aware of the other $ERROR_INFO
here right after the first emergence 😲
And changing all $ERROR_INFO
s to $!
made the build green finally!
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.
great, so rebase and merge?
I have a patch in my library now to add the alias :(
Hey there! I stopped by to offer a similar patch. As @bf4 suggested, it seems like the better fix would be to As @amatsuda pointed out, if we want to get the build running as soon as possible, locking |
@bf4 @craiglittle Thank you for the suggestion, but to me |
My two cents: |
Fair enough, works for me! @amatsuda Were you going to get the build green by locking down to the |
I'll merge once this is green. Thanks @amatsuda ! (and everyone else commenting) |
@amatsuda Looks like there's a different issue now, eh? |
@craiglittle Yeah, this is weird. I cannot reproduce the failure on my local machine... 😟 |
I'm working on another app and got this failure, and it was sufficient to do $ERROR_INFO ||= $!
if $ERROR_INFO..... This is important because it is also used below
Would that make people happy? |
"$ERROR_INFO is more confusing. It's obvious that $! is a special ruby global so is populated by magic, the comment explains. $ERROR_INFO feels like it was defined by us somewhere." #400 (comment)
"warning: global variable `$ERROR_INFO' not initialized"
Alright! Let's update the CHANGELOG and we can release 0.10.1! |
We're so close to the finish line. Looking forward to getting this warning out of my build! |
👍 to see this released! |
Would someone mind helping update the CHANGELOG? I am elsewhere |
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)
"$ERROR_INFO is more confusing. It's obvious that $! is a special ruby global so is populated by magic, the comment explains. $ERROR_INFO feels like it was defined by us somewhere." simplecov-ruby#400 (comment)
Hi, I'm having back this warning : $ bundle exec rspec
....
Randomized with seed 8732
*****/vendor/bundle/ruby/2.5.0/gems/simplecov-0.16.1/lib/simplecov.rb:177: warning: global variable `$ERROR_INFO' not initialized
Coverage report generated for RSpec ****** It seems that the English library doesn't declare it (I guess I'm wrong, but: https://github.com/rubyworks/english/search?utf8=✓&q=%24ERROR_INFO&type=). I happens to me since I've included dry-validation-matcher. $ bundle exec pry
[1] pry(main)> require 'english'
=> true
[2] pry(main)> defined? $ERROR_INFO
=> nil
[3] pry(main)> defined? $!
=> "global-variable"
[4] pry(main)> Fix proposallib/simplecov.rb:177 |
@ShamoX This was fixed nearly three years ago. Either you're on an old version or this is a new issue. 'English' is part of the Ruby standard library. |
This eliminates a Ruby⚠️ when run with
RUBYOPT="-w"
.You can easily reproduce the warning as follows:
% ruby -w -rsimplecov -e 'SimpleCov.pid = Process.pid'