Skip to content

ALL-ROUT0002 · unreached_declared_route

Count routes no client in this repository names, where other routes are named.

This is a deterministic rule for all languages. Read its implementation.

Report a declared route whose path no other file states as a literal, but only in a repository where some declared route is named that way. A route nobody calls is either a surface someone forgot to remove or a contract someone forgot to wire, and both cost the reader the same afternoon deciding which one it is. The guard matters more than the rule, because a repository holding only a server has its clients elsewhere, and every route in it would read as unreached.

Each finding names the method, the path, and where it is declared. The value is the number of unreached routes.

A route a mounted router composes a prefix onto is skipped, since the path a client states is not the path the declaration states. A parameterized route is skipped for the same reason, because /users/{id} and /users/7 are different strings and no literal match can prove they are the same route. A public API is legitimately unreached from inside its own repository, and a project that publishes one turns this rule off rather than deleting its surface.

In a repository whose frontend calls "/api/users" and "/api/orders", a declared "/api/legacy" that nothing names returns 1. In a repository with no client at all, every route returns 0, because there is nothing to conclude from silence.

  • Cites “Vulture documentation”, dead code detection and its stated confidence limits. Open reference
  • Cites “Refactoring”, remove dead code
  • Cites “OpenAPI Specification”, paths and operations. Open reference