Are there any gems which can enforce Ruby code conventions?

My two favorite gems for handling code cleanliness are Reek (https://github.com/troessner/reek) and Cane (https://github.com/square/cane). I don't know that they go down to the nitty-gritty of indentation and spacing, but they detect a lot of Ruby coding conventions that tend to otherwise get overlooked.

In terms of spacing / indentation / casing and so forth, I'd either look for an editor configuration (e.g., download a Ruby package for TextMate / Sublime Text / EMACS / what have you), or look into the BeautifyRuby gem (https://github.com/CraigWilliams/BeautifyRuby).


RuboCop is a static code analyzer based on the Ruby Style Guide, by the same author.

The Rails Best Practices gem can detect certain problems in Rails projects.