How Stripe formatted a 25-million-line Ruby codebase overnight with rubyfmt
rubyfmt is an autoformatter[1] for Ruby, a tool that rewrites code into one standard layout without any settings. Its author started it as a personal open-source project after a 2018 debate at RubyConf. Stripe runs the world's largest Ruby codebase, and the article says that before rubyfmt no true autoformatter for Ruby existed and earlier tools crashed on Stripe's files.
The tool had to be fast, because starting Ruby takes about 158 ms and about 345 ms inside a bundler environment, so the team set a 100 ms budget. The first version was a Ruby program built on ripper[2], and it was later rewritten in Rust, using serde[3] to read the parse data. When passing data through JSON proved slow, the author considered reading Ruby objects directly from memory.
The article describes two Stripe engineers who spent a Saturday morning on a Zoom call with 25 million lines of Ruby and a plan that had never been tried at that scale. The project was motivated by engineers new to Ruby, and Go engineers said they missed gofmt, which simply shapes code into a standard form.
Read the original stripe.devDiscussion
Discussion
Commenters mostly joke about the Saturday timing and the idea of formatting 25 million lines at once. One asks why codebase size matters for a formatter that works file by file, and another says slow rubocop runs make them consider rubyfmt.
Sources
-
Stripe
Formatting an entire 25 million line codebase overnight: the rubyfmt story


