fxn / zeitwerk

Efficient and thread-safe code loader for Ruby
MIT License
1.99k stars 118 forks source link

Ruby 3.3.0-rc1 warning issues #277

Closed kapso closed 10 months ago

kapso commented 10 months ago

my Gemfile file has the following gems

gem 'net-imap', '0.4.8'
gem 'net-pop', '0.1.2'
gem 'net-sftp', '4.0.0'
gem 'net-smtp', '0.4.0'

Error

2023-12-12T23:11:01.874558+00:00 app[worker_a.2]: /app/vendor/bundle/ruby/3.3.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: net/smtp was loaded from the standard library, but is not part of the default gems since Ruby 3.1.0. Add net-smtp to your Gemfile or gemspec.

2023-12-12T23:11:07.018957+00:00 app[worker_a.2]: /app/vendor/bundle/ruby/3.3.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: net/imap was loaded from the standard library, but is not part of the default gems since Ruby 3.1.0. Add net-imap to your Gemfile or gemspec.

2023-12-12T23:11:07.047173+00:00 app[worker_a.2]: /app/vendor/bundle/ruby/3.3.0+0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: net/pop was loaded from the standard library, but is not part of the default gems since Ruby 3.1.0. Add net-pop to your Gemfile or gemspec.

fxn commented 10 months ago

Hi, you see Zeitwerk in the stack trace because it decorates Kernel#require, but if you look at lib/zeitwerk/kernel.rb#38 you'll see that comes from the original Kernel#require the lib is wrapping.

That is, the warning is not really issued by Zeitwerk.

kapso commented 10 months ago

@fxn got it, thanks for the quick response. I will close this issue.

Earlopain commented 10 months ago

For others stumbling upon this, you can add something like puts caller.first if path == 'observer' to the afformentioned file to find out where the require originated from.