Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find Dead Rails Code

What is a good way to find methods in a that are not being called anymore? I'm in the process of refactoring a large Rails application and the worst thing you can find is code that is not being used anymore.

like image 997
Ibrahim Muhammad Avatar asked Dec 20 '12 20:12

Ibrahim Muhammad


1 Answers

This is a tricky problem without an easy, always-right answer. Some places to start include:

  1. Sweep unused code into the dustbin with rcov
  2. Performance Testing Ruby on Rails Applications
  3. Find unused code in a Rails app

The biggest issue is that unused code and unreachable code aren't the same things. Just because code isn't exercised routinely in production doesn't really mean it's dead code that should be removed. It may be there for a reason---just not one that comes up often.

like image 159
Todd A. Jacobs Avatar answered Oct 23 '22 05:10

Todd A. Jacobs