fables-tales / rubyfmt

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

`.squish` in SQL heredocs is moved to the closing SQL statement #450

Closed pjg closed 10 months ago

pjg commented 10 months ago

The cop: RuboCop::Cop::Rails::SquishedSQLHeredocs

Input file

<<~SQL.squish
  SELECT ...
SQL      

Rubyfmt's output

<<~SQL
  SELECT ...
SQL
  .squish

This breaks because

Not exactly a "break" per se, but the .squish call is moved into a weird place, which results in a code, which is weirdly idented/formatted.

I am not sure if this is only (a/my) style preference or rather incorrect rubyfmt behaviour, which should be fixed. I won't be posting such issues if it's the former.

fables-tales commented 10 months ago

I think Rubyfmt does the right thing here