rubocop is a code style checker for Ruby. A similar tool to rubocop, Cane, can be integrated with Rake. I prefer rubocop to Cane since rubocop makes checks based on the Ruby Sty
As of version 0.10.0 rubocop contain a custom rake task that you can use. Just put the following in your Rakefile
0.10.0
Rakefile
require 'rubocop/rake_task' RuboCop::RakeTask.new
Make sure to use upper-case 'R' and 'C' or you will get a NameError.