🕷 zenspider.com

by ryan davis

Looking for the Ruby Quickref?

Meet Debride

Published 2015-03-12 @ 12:00

Tagged debride

I released a new tool named debride while on the road for Ruby on Ales and Mountain West Ruby Conf. It’s a fairly simple tool that can analyze code for potentially uncalled / dead methods. If you suspect that you have dead code but don’t know how to go about identifying it, you might want to check out debride.

% debride lib

These methods MIGHT not be called:

  method!                            lib/some/file.rb:16

What’s dead code? To debride, it is any method defined that doesn’t appear to have a call anywhere else. So this tool isn’t as good for public API unless you also run your tests against it (but that is prone to keeping well-tested dead code alive).


There are obvious problems to using a static analyzer for a highly dynamic language like ruby. The first is send. I’m toying with the idea of providing a send wrapper that’ll log all method names to a file that you can then review and whitelist for subsequent runs on debride, but I’m totally open to suggestions & PRs.