0.0
The project is in a healthy, maintained state
Analyze Rails routes for shadowing, duplicates, unreachable routes, and maintainability metrics.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 2.4
~> 13.0
~> 3.12
~> 0.22

Runtime

>= 6.1
~> 3.1
~> 1.2
 Project Readme

RouteGuard

RouteGuard is a production-ready static analysis tool for Rails routing. It inspects your Rails routes to catch issues Rails itself doesn't report—like shadowing, duplicates, unreachable catch-alls, and duplicate resource blocks.

Core Features

  • Duplicate Route Detection: Detects routes sharing the same HTTP verb and path pattern.
  • Route Shadowing: Flags routes that can never be matched because an earlier route matches first (e.g. /users/:id shadowing /users/new).
  • Unreachable Routes: Detects routes defined after catch-all wildcard routes (e.g. match "*path").
  • Duplicate Named Helpers: Identifies duplicate helper names (e.g., duplicate auth_path helpers pointing to different paths).
  • Duplicate Resources: Warns when identical resources are declared multiple times in the same namespace scope.
  • Route Statistics: Computes REST resources count, nested scopes, and wildcards.
  • Health Score: Measures a 0-100 maintainability score based on issues and path nesting levels.

Quick Start

Installation

Add this gem to your group :development, :test block:

group :development, :test do
  gem "route_guard", path: "path/to/route_guard"
end

Run bundle install.

Run RouteGuard

Run check from the terminal:

bundle exec route_guard check

Or execute via Rake tasks:

bundle exec rails route_guard
bundle exec rails routes:doctor

Documentation

For detailed configurations, options, and workflows, please see:

License

MIT License.