Finding Unused Code in Rails

Using rcov along with your tests is great - you can quickly identify untested code. But what if you want to find unused code? Just because you have a test written for a method doesn't mean you're using it in your application.

rcov script/server

Start WEBrick through rcov, and click through your application. When you're done you'll have a coverage report identifying any unused code. This is a great way to make sure you're not calling that deprecated method before you actually delete it.

Posted on 2006-11-21 | permalink

I'm the CTO of Braintree, I write software (mostly in Ruby) and am an on-and-off runner.
We're assembling a team of incredible developers in Chicago. Send me an e-mail if you're interested in hearing more. dan@braintreepayments.com

braintree devs blogroll

tweets