Rob
Rob

Reputation: 637

Cannot suppress Ruby 2.7.0 warnings

I followed the question here, specifically adding

export RUBYOPT='-W:no-deprecated -W:no-experimental'

to my .zshrc file.

Despite doing this, I'm still getting loads of warnings. E.g.,:

/Users/XXX/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sqlite3-1.4.1/lib/sqlite3/database.rb:89: warning: rb_check_safe_obj will be removed in Ruby 3.0
/Users/XXX/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/integer.rb:13: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/XXX/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/activemodel-6.0.2.1/lib/active_model/type/value.rb:8: warning: The called method `initialize' is defined here

I'm not sure why the RUBYOPT suppression is not being pulled through.

Upvotes: 8

Views: 1504

Answers (1)

Sam Winstanley
Sam Winstanley

Reputation: 99

I think you should try a test like this...

RUBYOPT='-W:no-experimental -W:no-deprecated'  irb
>> Warning[:experimental]
false
>> Warning[:deprecated]
false

If you don't see output like I put above something is wrong.

You didn't mention your original command line that produced those warnings. It could be that something in your code, or a Gem you are using is changing the Warning[:deprecated] = true. Meaning whatever you put for your -W option is being ignored.

Upvotes: 1

Related Questions