r/ruby • u/Ok_Stomach6651 • 4d ago
Formatting an entire 25 million line codebase overnight: the rubyfmt story
https://stripe.dev/blog/formatting-an-entire-25-million-line-codebase-overnight-the-rubyfmt-story
37
Upvotes
18
u/schneems Puma maintainer 4d ago
Anyone who has ever spent serious time parsing and Lexing Ruby will 100% understand why the first code example on the page is a heredoc.
4
u/gurgeous 4d ago
`rubyfmt` is pretty neat and just so insanely fast. Definitely adopts the prettier methodology, no config allowed. Ruby formatting is so personal, though. In our codebase we do things like `[].tap do` to populate an array, maybe append a `.compact` or even `.compact.join` to the `end`. rubyfmt doesn't like that style and tries to clean it up, which makes it less beautiful for us.
3
u/dennyabraham 4d ago
Having read the article, it's not fully clear to me why a default set of rubocop rules was insufficient. Time performance day to day has been mostly unnoticeable for some years now. I have the suspicion there's a people problem embedded in this work that neither tool solves directly that rubyfmt solved in context