HeadlinesBriefing favicon HeadlinesBriefing.com

Rubyfmt Revolutionizes Stripe's 25M-Line Codebase with Zero-Config Formatting

Hacker News •
×

Stripe engineers tackled the monumental task of formatting their 25 million line Ruby codebase using rubyfmt, a zero-configuration autoformatter that eliminates style debates. Before its creation, Ruby lacked reliable formatting tools, with existing solutions crashing on large files. The project began in 2018 after a heated debate at RubyConf about Ruby's formatting chaos, inspiring the creator to build a tool akin to Go's `gofmt`.

To meet Stripe's demand for speed, rubyfmt had to process files under 100ms—a challenge requiring deep technical optimizations. Initially written in Ruby, it struggled with startup times (158ms baseline) until engineers compiled a C program linked to `libruby` for near-instant execution. Later, a Rust rewrite addressed parsing bottlenecks, using `ripper` for accurate syntax analysis and `serde` for cross-language data conversion. The tool avoided gems and Bundler dependencies to stay within speed limits, even bundling source files into a single script for deployment.

The impact extends beyond Stripe: rubyfmt helps engineers from non-Ruby backgrounds focus on logic over style. Go developers, accustomed to `gofmt`, found Ruby's flexibility overwhelming without autoformatting. By enforcing consistent formatting, the tool reduces PR bikeshedding and accelerates onboarding. Its success highlights the critical role of architectural decisions in scaling developer workflows, proving that even mature ecosystems can benefit from reimagined tooling.