Milan Novota
Milan Novota

Reputation: 15598

Automated code sanity check tools for Ruby

What tools do you use for automated code sanity checks and adhering to the coding conventions in your Ruby apps? How do you incorporate them into your process? (I mean tools like roodi, reek, heckle, rcov, dcov, etc.)

Upvotes: 5

Views: 1353

Answers (3)

Bozhidar Batsov
Bozhidar Batsov

Reputation: 56645

I'd suggest taking a look at RuboCop. It is a Ruby code style checker based on the Ruby Style Guide. It's maintained pretty actively and it's based on standard Ruby tooling (like the ripper library). It works well with Ruby 1.9 and 2.0 and has great Emacs integration.

Upvotes: 3

kevinrutherford
kevinrutherford

Reputation: 448

There was some good discussion on this topic on the On-Ruby blog recently. For my personal development process I build quality tools into my tests, but only after all other tests have run. So I have a top-level rake task that looks something like this:

desc 'Runs all unit tests, acceptance tests and quality checks'
task 'test' => ['test:spec', 'test:features', 'test:quality']

I allow myself to commit if the last suite "fails", but I do try to get them to zero at least once each day.

Upvotes: 1

Greg Borenstein
Greg Borenstein

Reputation: 1546

The metric_fu gem might be perfect for what you need. From it's README: "Metric-fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Rcov, and Rails' built-in stats task to create a series of reports. It's designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder." Since they converted it to a gem, it works with non-Rails applications as well. I'll bet you could add hooks for other tools as well.

Upvotes: 1

Related Questions