Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find unused methods in a Ruby app?

I have a Ruby app with a lot of classes/modules, and some of them are not used. Is there an easy way of finding out which?

I was thinking to do a profile, and then work with it's output. Any other ideas?

like image 347
Geo Avatar asked Jun 02 '10 14:06

Geo


People also ask

Where is unused method in Android Studio?

Android Studio -> Preferences... -> Plugins -> Browse Repositories -> QAPlug.

How do I find unused methods in C#?

Right click on your solution and selection "Find Code Issues". One of the results is "Unused Symbols". This will show you classes, methods, etc., that aren't used.

How can I see unused methods in eclipse?

UCDetector (Unnecessary Code Detector) is a eclipse PlugIn tool to find unnecessary (dead) public java code. For example public classes, methods or fields which have no references.


1 Answers

A coverage tool, like rcov might help.

https://github.com/relevance/rcov

As you find methods that are not covered by tests, you should write tests for them or find out if they are used at all.

Removing unused methods is part of refactoring, if you have too many classes that can be a code smell that needs refactored also.

like image 176
Freiheit Avatar answered Oct 12 '22 01:10

Freiheit