whitequark / parser

A Ruby parser.
Other
1.57k stars 197 forks source link

* Add Racc to runtime dependencies #929

Closed koic closed 1 year ago

koic commented 1 year ago

Follow up https://github.com/ruby/ruby/pull/7877.

Ruby 3.3.0dev is set to promote Racc to a bundled gem. Therefore, this PR adds Racc to runtime dependencies to prevents the following error in RuboCop:

bundle exec rake internal_investigation

rake aborted!
LoadError: cannot load such file -- racc/parser
<internal:/usr/local/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/bundle/gems/parser-3.2.2.1/lib/parser.rb:12:in `<top (required)>'
<internal:/usr/local/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/bundle/gems/rubocop-ast-1.29.0/lib/rubocop/ast.rb:3:in `<top (required)>'
/usr/local/bundle/gems/rubocop-ast-1.29.0/lib/rubocop-ast.rb:3:in `require_relative'
/usr/local/bundle/gems/rubocop-ast-1.29.0/lib/rubocop-ast.rb:3:in `<top (required)>'

https://app.circleci.com/pipelines/github/rubocop/rubocop/9387/workflows/c308ef87-1373-4c0a-b90d-a22ea57860e3/jobs/279345

Since the Parser gem supports Ruby 2.0.0 and above, So, Racc runtime version is not specified to accept older Racc versions. Development version of Racc 1.7.0 has been added to the Gemfile.

iliabylich commented 1 year ago

Ah, now it makes sense, I completely missed the fact that it's a dev dependency 🤦 . That's where the difference between parser's and rubocop's test suites come from.

Is it safe to specify no version constraint for racc?

koic commented 1 year ago

Honestly, I'm not entirely confident. However, given that there has never been a specific runtime version required for Racc, I believe it is least likely to encounter incompatibilities.

iliabylich commented 1 year ago

Good point 👍

iliabylich commented 1 year ago

3.2.2.3 has been released. Could you check if works with RuboCop please?

koic commented 1 year ago

@iliabylich I opened https://github.com/rubocop/rubocop/pull/11942 using Parser 3.2.2.3 with RuboCop and the Ruby 3.3.0dev CI matrices are successful. Thanks for the quick release!

hsbt commented 1 year ago

@koic @iliabylich I appreciate this work. Thanks!