fables-tales / rubyfmt

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

Wrong correction on trailing comma in block argument list #442

Open bquorning opened 1 year ago

bquorning commented 1 year ago

Input file

foo = [[1, 2], [3, 4]]
foo.each do |bar,|
  p(bar)
end

Rubyfmt's output

foo = [[1, 2], [3, 4]]
foo.each do |bar|
  p(bar)
end

This breaks because

With the block argument list |bar,|, the value of bar inside the block will be 1 and 3. With the block argument list |bar|, the value of bar inside the block will be [1, 2] and [3, 4].