Presubmit.Adapters.PhoenixRouter (presubmit v0.2.2)

Copy Markdown View Source

Models Phoenix routers (use Phoenix.Router, or use MyAppWeb, :router) as a flat list of routes with plug modules fully resolved.

Recognised shapes: scope (with a positional alias, alias: option, or neither) nested to any depth, the HTTP verb macros, match, live, live_session, forward, and resources (expanded to its actions, honouring only:/except:/singleton:).

Phoenix concatenates the enclosing scope aliases onto a route's plug, so get "/posts", PostController inside scope "/", MyAppWeb resolves to MyAppWeb.PostController. That resolution is reproduced here.

Summary

Functions

Every plug module the router routes to.

Whether the router has a route to plug.

Types

t()

@type t() :: %Presubmit.Adapters.PhoenixRouter{
  module: module(),
  routes: [Presubmit.Adapters.PhoenixRouter.Route.t()]
}

Functions

plugs(phoenix_router)

@spec plugs(t()) :: [module()]

Every plug module the router routes to.

routes?(router, plug)

@spec routes?(t(), module()) :: boolean()

Whether the router has a route to plug.