You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
We’re encountering a NoMethodError when Packwerk parses code that uses Ruby’s newer keyword argument shorthand (e.g., param_id: without explicitly specifying param_id: param_id). The error consistently appears when running packwerk check.
To Reproduce
Use Ruby 3.1 (or higher).
In a file (e.g., app/services/create_a_thing.rb), write:
classCreateAThingdefcall(param_id)# Using Ruby’s shorthand keyword argument syntaxRecord.find_by(param_id:,active: true)endend
Run bundle exec packwerk check.
Packwerk fails with a stack trace ending in:
undefined method `pair_label' for #<Packwerk::Parsers::Ruby::TolerateInvalidUtf8Builder:0x0000...>
Expected Behaviour
Packwerk should parse this syntax successfully (it’s valid Ruby 3 code) and continue checking for violations without raising an error.
Version Information
Packwerk: 3.2.2
Prism: 1.3.0
Ruby: 3.1.4
Additional Context
The error is linked to code that uses the “shorthand” keyword argument syntax introduced in Ruby 3 (e.g., param_id: in place of param_id: param_id).
If we rewrite the shorthand argument to the more explicit Record.find_by(param_id: param_id, active: true), Packwerk no longer fails.
Our investigation suggests Prism expects a builder method pair_label, but Packwerk’s custom TolerateInvalidUtf8Builder does not implement it.
We’ve tried upgrading Prism (currently on 1.3.0), but the error persists.
Description
We’re encountering a NoMethodError when Packwerk parses code that uses Ruby’s newer keyword argument shorthand (e.g., param_id: without explicitly specifying param_id: param_id). The error consistently appears when running packwerk check.
To Reproduce
Use Ruby 3.1 (or higher).
In a file (e.g., app/services/create_a_thing.rb), write:
Run
bundle exec packwerk check
.Packwerk fails with a stack trace ending in:
Expected Behaviour
Packwerk should parse this syntax successfully (it’s valid Ruby 3 code) and continue checking for violations without raising an error.
Version Information
Additional Context
Stacktrace:
The text was updated successfully, but these errors were encountered: