Skip to content

grassiricardo/rails_unused

Repository files navigation

Captura_de_Tela_2025-04-14_às_22 39 58-removebg-preview

Rails Unused

Dead code analyzer for Ruby on Rails projects.
Simple CLI tool that finds unused controllers, models, and services in your Rails app.

Installation

Add to your Gemfile:

gem 'rails_unused'

Then execute:

bundle install

Or install directly:

gem install rails_unused

Usage

Inside your Rails project:

bundle exec rails_unused

Example output:

Possible unused controllers:
  - Admin::LegacyController

Possible unused models:
  - OldCustomer

Possible unused services:
  - User::CleanupService

How it works

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

Limitations

Simple static analysis.

False positives may happen if:

  • Using metaprogramming
  • Dynamic class loading
  • External references

Always review before deleting.

Roadmap

See ROADMAP.md for future improvements.

Contributing

Pull requests are welcome!

Badge

No Unused Code

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published