ruby-formatter / rufo

The Ruby Formatter
MIT License
894 stars 56 forks source link

Keyword argument(s) in parenthesis-less method definition result in invalid code #331

Open pjg opened 1 week ago

pjg commented 1 week ago

Ruby 3.2.5 rufo 0.18.0

parens_in_def :dynamic
quote_style :single
class User
  def self.by_uid uid:
    joins(:authentications).where(authentications: { uid: }).first
  end
end
rufo app/models/user.rb

results in broken ruby code (all squashed into a single line):

class X
  def self.by_uid uid: joins(:authentications).where(authentications: { uid: }).first end
end
circular argument reference - uid
.../app/models/user.rb:2: syntax error, unexpected `end', expecting ';' or '\n'
...ntications: { uid: }).first end