[Bug Report] `packwerk validate` fails with uninitialized constant <Class:Packwerk::PackageSet>::Bundler
dmitri-minkin opened this issue · 0 comments
dmitri-minkin commented
Description
packwerk validate
fails on minimalistic new Rails app
To Reproduce
- Create new folder for the application
- In that folder create new Rails app:
rails new sportsball
- Add
gem 'packwerk'
to Gemfile - Change ruby version to 3.1.2 in .ruby-version and Gemfile
- Call bundler to install gems:
bundle install
- Add packwerk binstub:
bundle binstub packwerk
- Initialize packwerk:
bin/packwerk init
- Validate that packwerk is installed correctly:
packwerk validate
Notice the failure:
📦 Packwerk is running validation...
/Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/package_set.rb:45:in `package_paths': uninitialized constant #Class:Packwerk::PackageSet::Bundler (NameError)
.push(Bundler.bundle_path.join("**").to_s)
^^^^^^^
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/package_set.rb:24:in `load_all_from'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/application_validator.rb:25:in `initialize'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:157:in `new'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:157:in `checker'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:147:in `block in validate'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/formatters/progress_formatter.rb:26:in `block in started_validation'
from /opt/rubies/3.1.2/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/formatters/progress_formatter.rb:26:in `started_validation'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:146:in `validate'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:62:in `execute_command'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/lib/packwerk/cli.rb:43:in `run'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `bind_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/call_validation.rb:161:in `validate_call'
from /Users/{user}/.gem/ruby/3.1.2/gems/sorbet-runtime-0.5.10151/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
from /Users/{user}/.gem/ruby/3.1.2/gems/packwerk-2.2.0/exe/packwerk:12:in `<top (required)>'
from /Users/{user}/.gem/ruby/3.1.2/bin/packwerk:25:in `load'
from /Users/{user}/.gem/ruby/3.1.2/bin/packwerk:25:in `<main>'
Expected Behaviour
no error.
validation should either succeed or fail with a message, not exception.
Screenshots
If applicable, add screenshots to help explain your problem.
Version Information
- Packwerk: 2.2.0
- Ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
Additional Context
bin/packwerk validate
succeeds
packwerk check
succeeds