Rubyfmt is a Ruby autoformatter

Rubyfmt is a Ruby autoformatter
Average rating: 0
(0 votes)

You could have noticed already that Ruby is our language of choice. It’s too awesome not to use it! And we are never tired of reminding you that. But it seems we never told you about Rubyfmt before. We will try to fix that in today’s article. Rubyfmt is a Ruby autoformatter that we want to share with you.

Rubyfmt is a Ruby autoformatter in the style of gofmt. Unlike rubocop, it is intended to only be a formatter, and not any kind of deeper analysis tool. Rubyfmt is currently “functional” in the sense that it can execute over the entirety of rspec/rspec-core and not break any of the tests.

Rubyfmt is a standalone script that only loads the standard library of Ruby, as such, it is not packaged as a gem. It is intended to be in your editor’s save hook and run really fast.

  • Download src/rubyfmt.rb to ~/bin
  • Add ~/bin to your PATH (e.g. echo "$HOME/bin:$PATH" >> ~/.bash_profile)
  • Set your editor to run rubyfmt file_name > file_name on save.

Rubyfmt considers any file going through the formatter, and coming out the other side with changed semantics to be a bug. Please find all the necessary information here.

By the way, you have a chance to take Ruby Certification with us. Are you in?

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

*By submitting this form you agree with our Privacy Policy.

Mailing & Legal Address

Syndicode Inc. 340 S Lemon Ave #3299, Walnut CA, 91789, USA

Visiting & Headquarters address
Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
Email info@syndicode.com
Phone (+1) 9035021111