alofmt is a fast, deterministic formatter for Ruby source code. It uses Prism to understand Ruby syntax and implements its formatting engine in Rust, combining source-aware formatting with an emphasis on predictable and repeatable output.
The formatter takes a strict approach to problematic input. Instead of attempting to produce partially formatted output when syntax cannot be handled safely, it reports the problem. Formatting policy can be kept with the project, giving teams a reproducible style without embedding formatting logic into their own tooling.
This is free and open source software.
Key Features
- Formats Ruby .rb files and Ruby interface .rbi files.
- Rewrites discovered files in place with its write mode.
- Checks whether files are correctly formatted without changing them.
- Can display a diff when a formatting check detects changes.
- Processes directory discovery and formatting work in parallel.
- Respects .gitignore when scanning project trees.
- Reads Ruby source from standard input and can print formatted single-file output.
- Uses Prism for Ruby parsing.
- Stores project formatting policy in .alofmt.toml.
- Searches the current directory and its parents for the nearest configuration file.
- Allows command-line options to override project configuration for an individual run.
- Provides settings for line width, indentation width, quotation style and trailing commas.
- Treats invalid input, parser failures, unsupported syntax and misspelled configuration keys as explicit errors.
- Returns an error for unsupported Prism nodes rather than silently producing partial or lossy formatting.
- Exposes the formatter as a Rust library for embedding in other development tools.
- Provides allocation-free checks through its library interface where appropriate.
- Produces stable reporting even though formatting work can run concurrently.
Website: github.com/StileEducation/alofmt
Support:
Developer: Stile Education
License: MIT License
alofmt is written in Rust. Learn Rust with our recommended free books and free tutorials.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.