There are many tools in the Ruby ecosystem to help you write better code. Here are a few of my favorites: Code Climate: I love these guys. Code Climate allows you to grade your codebase on a 4.0 GPA scale based on a variety of metrics such as complexity, DRYness and maintainability. Although their paid plans are a little bit pricey, they offer a community version that is free for open source.
SimpleCov: Let’s face it- sometimes you forget to write test coverage despite your best efforts. SimpleCov runs inside your test suite and helps you pinpoint lines of code that are neglected by your test suite. All output is neatly displayed in your browser as static HTML.
Inch: I just discovered this one. It’s a documentation coverage generator with a very nice output format. Similar to
Coveralls: Similar to SimpleCov, with a prettier web based interface. Free for open source with premium plans available.
Metric Fu: Metric Fu is a bundle of 10 different static analysis tools for Ruby (and Rails). It is run by using the metric_fu command at the command line and outputs everything to static HTML files. What I like most about Metric Fu is its ability to track code quality over time (using git).
RuboCop: A Ruby static code analyzer, based on the community Ruby style guide. It integrates well with Sublime Text to give you realtime feedback on the code you are working on. If you are feeling particularly brave, it will even auto-correct your Ruby files for you (be careful, though..).
Hound: Hound was written by the folks at ThoughtBot with the intention of making code reviews more effective. I haven’t had a chance to look at it yet but it looks very promising.