Formatting an Entire 25 Million Line Codebase Overnight: The rubyfmt Story
Review rubyfmt's performance on large monorepos to ensure it meets your CI throughput.
Review your CI pipeline and integrate rubyfmt to reduce formatting build times.
Summary
Rubyfmt, a new formatting tool, claims to format a 25 million line Ruby monorepo overnight, a feat that could dramatically speed up CI pipelines for large teams. The tool is written in Ruby and leverages parallel processing across all available CPU cores, achieving a throughput of roughly 1.5 million lines per second on a typical workstation. It exposes a simple CLI interface that integrates cleanly with existing CI systems, allowing developers to run formatting checks as a lightweight pre‑commit hook or as part of a nightly build. Rubyfmt supports custom formatting rules via a YAML configuration file, enabling teams to enforce project‑specific style guidelines without sacrificing speed. The authors emphasize that the tool can handle complex syntax constructs, such as nested blocks and multi‑line method calls, without mis‑formatting or introducing syntax errors. Benchmarks show that rubyfmt outperforms other popular formatters like RuboCop’s autocorrect mode by a factor of 4 to 6, depending on the codebase size. The project also includes a CI integration script that automatically reports formatting violations as build failures, ensuring code quality is maintained across the entire repository. With its focus on performance and ease of integration, rubyfmt positions itself as a practical solution for teams that need to keep large Ruby codebases clean without incurring long build times.
Key changes
- Formats 25 million line Ruby codebase overnight
- Built in Ruby with parallel processing across CPU cores
- CLI interface integrates with CI systems
- Supports custom formatting rules via YAML
- Handles complex syntax constructs without errors
- Achieves ~1.5 million lines per second on typical workstation
- Outperforms RuboCop autocorrect by 4–6×
- Includes CI integration script for automatic build failures