Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

alofmt is a configurable Ruby formatter written in Rust and powered by Prism. You can install it with Cargo, preview or check formatting before changing files, and set project-wide style rules in .alofmt.toml. It is pre-1.0, however, and unsupported syntax can produce an error, so validate it against your Ruby codebase before relying on it.

What alofmt does

alofmt reformats Ruby source into a more consistent layout. Its documentation demonstrates formatting chained expressions, blocks, hashes, and comments across multiple lines, but that example is not a promise of support for every Ruby construct. The project describes its syntax coverage as broad and growing.

The tool is implemented in Rust and uses Prism. The reviewed documentation identifies release 0.1.0, dated August 28, 2026, and describes both a command-line formatter and a Rust library interface. Project documentation

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install alofmt and run it on Ruby files

The documented installation route uses Cargo, Rust’s package manager:

#1 Best Overall
cargo install --locked alofmt

From the project directory, choose the command that matches the task:

Command Effect
alofmt --write . Formats discovered files in place.
alofmt --check . Checks formatting without changing files.
alofmt --check --diff . Checks formatting and shows proposed changes.

alofmt discovers .rb and .rbi files, respects .gitignore, and formats files in parallel. For a single file, omitting both --write and --check prints formatted output instead of modifying the file. A hyphen (-) selects standard input, so formatted output can be used in a pipe or script.

Check changes before applying them

To review a project without writing changes, run:

alofmt --check --diff .

Use --check in a CI job when you want the job to detect formatting differences without rewriting the checkout. Use --write when you intend to apply formatting locally. The documented commands provide a practical preview-and-apply workflow; confirm how your own scripts handle a non-clean check before adding it to automation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set formatting rules in .alofmt.toml

alofmt reads .alofmt.toml from the current directory or a parent directory, selecting the nearest configuration it finds. Command-line options take precedence over configuration values for that run. Documented settings include:

  • line_width to control line length.
  • indent_width to set indentation width; the stated default is two spaces.
  • quote_style to select quote handling; the stated default preserves existing quotes.
  • trailing_commas to control trailing commas.

Consult the project’s configuration documentation for accepted values and syntax before adding settings to a repository. Keeping shared rules in the project configuration makes formatting behavior consistent across local use and automation, while a command-line override is useful for a one-off run.

What to expect when syntax is unsupported

The project labels alofmt pre-1.0 and says Ruby syntax support is still expanding. When it encounters an unsupported Prism node, it returns an error rather than emitting partial or lossy formatting. That is a safer failure mode than silently rewriting only part of a file, but it means a formatting run can fail on syntax present in a real codebase.

  • Try the formatter on representative files before adopting it across a repository.
  • Include less-common constructs and interface files with the .rbi extension in that evaluation.
  • Run a check or inspect a diff before applying changes broadly.
  • Keep the existing source and review any errors instead of treating a failed run as a successful format.

The reviewed documentation does not state a Ruby-version compatibility matrix. If compatibility with a specific Ruby version matters, verify that against the project’s current documentation rather than assuming support.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the Rust library interface

For Rust tooling that needs to format Ruby source, alofmt also exposes a library API. The documentation describes formatting through format_with_options and a FormatOptions structure, as well as allocation-free checks. This is distinct from invoking the command-line tool: library consumers can integrate formatting or checks into a Rust application. Refer to the project documentation for API details and current behavior.

Performance claims and project maturity

The documentation promotes speed and parallel processing, but the reviewed page gives no named benchmark, test methodology, comparative result, or independently measured performance figure. There is not enough evidence to claim a particular speedup or rank alofmt as the fastest Ruby formatter. To assess performance for your use, measure it on a representative project and workflow.

The documentation states that alofmt is available under the MIT license. Because the project is pre-1.0 and syntax coverage is growing, assess both its behavior and its fit for your codebase before making it a required formatting step.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.