Is there a way to find classes and methods that are not used in a Ruby project? The case was: I have a Ruby project (using Sinatra), and the previous programmer forgot to delete many classes and methods that are no longer in use.
Asked
Active
Viewed 80 times
3
-
1What is the test suite like? Solid enough that you could use coverage from the tests to guide you? I'm not aware of any clever tools that can fully automate this - in fact I'd suspect you hit a variant of the halting problem when analysing code looking for unreachable parts. – Neil Slater Nov 11 '13 at 08:10
-
2I would think about using `Coverage` that comes with Ruby 1.9 (and above). You can run that on your production system, let it log after each request into a file or a fast db (redis?) and after some time (depending on the load of your system) you can analyse the collected data. – spickermann Nov 11 '13 at 09:13
1 Answers
1
you can do a smoke test on your site, which will visit all the link of your site, or write a crawler yourself, and use coverage tool to log every method that has been call.

nickcen
- 1,682
- 10
- 10