Dead code analyzer for Ruby on Rails projects.
Simple CLI tool that finds unused controllers, models, and services in your Rails app.
Add to your Gemfile:
gem 'rails_unused'
Then execute:
bundle install
Or install directly:
gem install rails_unused
Inside your Rails project:
bundle exec rails_unused
Example output:
Possible unused controllers:
- Admin::LegacyController
Possible unused models:
- OldCustomer
Possible unused services:
- User::CleanupService
Type | Search logic |
---|---|
Controllers | Checks if class name appears in config/routes.rb |
Models | Checks if class name is referenced anywhere |
Services | Checks if class name is referenced anywhere |
Simple static analysis.
False positives may happen if:
- Using metaprogramming
- Dynamic class loading
- External references
Always review before deleting.
See ROADMAP.md for future improvements.
Pull requests are welcome!