Rufo is an opinionated Ruby code formatter focused on applying a consistent style without aggressively destroying deliberate layout decisions that already make source code easier to read. It offers relatively little configuration compared with tools that expose large collections of individual formatting rules.
Rufo works from the structure of the Ruby program rather than performing simple textual substitutions. It combines parsed source information with lexical tokens, an approach that lets the formatter understand the surrounding program while retaining information such as comments and intentional layout.
This is free and open source software.
Key Features
- Formats individual Ruby files or entire directory trees from the command line.
- Accepts Ruby source through standard input for pipelines and editor integrations.
- Provides a check mode that reports files whose formatting would change.
- Uses Ruby’s Ripper parser and lexer to understand source structure and tokens.
- Preserves comments by working with lexical information as well as the parsed program shape.
- Uses a deliberately limited configuration model rather than exposing a large collection of style switches.
- Reads project-specific settings from a .rufo file.
- Preserves several forms of intentional alignment by default instead of normalizing every spacing choice.
- Supports aligned method calls, arguments, parameters and array layouts where the existing formatting is considered valid.
- Has no runtime dependencies beyond Ruby itself.
- Can be configured to run automatically when files are saved in supported editors.
- Has integrations or documented plugins for Vim, Emacs, Visual Studio Code, Sublime Text and other editors.
- Can format code on demand as well as through automated editor workflows.
- Returns distinct exit statuses for unchanged input, errors and files whose formatted output differs from the source.
Website: github.com/ruby-formatter/rufo
Support:
Developer: Ary Borenszweig
License: MIT License
Rufo is written in Ruby. Learn Ruby 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.