fables-tales/rubyfmt

Dropping brackets around string arguments in chained method calls

Closed this issue · 0 comments

  • Ruby version: 3.1.3
  • Rubyfmt git sha: 266b47b

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.