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.
Find Dead Rails Code
Asked Answered
yeah, if I get a list of all methods for all classes defined in my application, could possibly grep them to see if they exist in other files. –
Theodoratheodore
possible duplicate of Find unused code in a Rails app –
Frightful
This is a tricky problem without an easy, always-right answer. Some places to start include:
- Sweep unused code into the dustbin with rcov
- Performance Testing Ruby on Rails Applications
- 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.
Thanks, I was looking for something like how rails_best_practices shows unused methods, didn't realize it had that functionality –
Theodoratheodore
© 2022 - 2024 — McMap. All rights reserved.