fables-tales / rubyfmt

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

Changes code behavior on .split()? #421

Closed nelson-vantage closed 9 months ago

nelson-vantage commented 1 year ago

Input file

if source.include?('something/')
    source.split('something/').last
end

Rubyfmt's output

if source.include?("something/")
  source.split "something/".last
end

This breaks because

Expected rubyfmt to simply replace the single quotes with double quotes, but instead it left out the parens on the call to #split which changes the behavior of the program. 😨

reese commented 1 year ago

Have you tested this on the current master branch? I'm fairly certain this is fixed by #415 and that this is a duplicate of #418 and #414.

nelson-vantage commented 1 year ago

Ah, definitely a duplicate of the other issues. Can I push for a new release so others trying out rubyfmt aren't burnt by this? Any behavior change in formatted code generates a huge amount of distrust in the tool. 😬

reese commented 1 year ago

(cc @fables-tales, might not be a bad idea to do a patch release since there are several other fixes on trunk now)

reese commented 9 months ago

Doing some cleanup: this is now out in the most recent release (v0.10.0)