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

PP requires a require in chamber show #84

Closed
ttilberg opened this issue Sep 19, 2024 · 2 comments
Closed

PP requires a require in chamber show #84

ttilberg opened this issue Sep 19, 2024 · 2 comments

Comments

@ttilberg
Copy link

Running chamber show executes PP.pp(...). The constant PP is not found. Instead the user receives an uninitialized constant error.

▶ chamber show
/Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/chamber-3.1.0/lib/chamber/commands/show.rb:22:in `call': uninitialized constant Chamber::Commands::Show::PP (NameError)

      PP
      ^^
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/chamber-3.1.0/lib/chamber/commands/base.rb:15:in `call'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/chamber-3.1.0/lib/chamber/binary/runner.rb:78:in `show'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/base.rb:584:in `start'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/chamber-3.1.0/bin/chamber:7:in `<top (required)>'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/bin/chamber:25:in `load'
	from /Users/ttilberg/.asdf/installs/ruby/3.3.5/bin/chamber:25:in `<main>'

At first I thought this may be related to recent changes to Ruby's standard lib/default gems, but I've tried running chamber show from a variety of older ruby versions across a variety of OSs. I've tested using macos with the following ruby versions:

  2.7.5
  3.0.6
  3.1.2
  3.2.4
  3.3.5

and Ubuntu 24.04 with Ruby 3.0.3.

I don't think this is related to recent changes related to default gems. It is currently a default gem and hasn't moved recently from what I can tell. https://stdgems.org/pp/

Adding require 'pp' to the top of the show file fixes the constant lookup.

@ttilberg
Copy link
Author

I see that a commit from last year removed this require statement:
fe82e96

It was labeled as Chore: Autofix (Safe) 'Lint/RedundantRequireStatement', however it seems to not have been safe afterall.

@jfelchner
Copy link
Collaborator

Very odd. I use this all the time and have never run into this. But you seem to be correct here. The only reason it was removed is due to the Rubocop cop so seeing as how that cop is now marked as "unsafe", I'm happy to add it back in :) Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants