fables-tales / rubyfmt

Ruby Autoformatter!
MIT License
1.08k stars 50 forks source link

Dropping brackets around string arguments in chained method calls #414

Closed jakubkosinski closed 1 year ago

jakubkosinski commented 1 year ago

Input file

scope :with_ticket_types, -> { group('shops.id').joins('LEFT JOIN foos ON foos.bar_id 
= bars.id').select('foos.*, COUNT(bars.id) count') }

Rubyfmt's output

scope(
  :with_ticket_types,
  -> { group "shops.id".joins "LEFT JOIN foos ON foos.bar_id = bars.id".select("foos.*, COUNT(bars.id) count") }
)

This breaks because

There are no brackets over group and join calls so that invalid syntax is being produced - joins & select are called on a string instances.