Analyzer::Elixir::Phoenix
Inherits Analyzer::Elixir::ElixirEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object
Constants
Elixir double-quoted strings interpolate #{expr}, and the
Phoenix Router DSL captures the literal characters between
quotes. Without normalization, get "/api/#{@version}/items"
produced URL /api/#{@version}/items with the #{@…} syntax
leaking into the path. Rewrite each interpolation site to a
{name} placeholder (stripping any leading @ module-
attribute sigil) so the path-parameter extractor recognises
it and the URL template reads cleanly. Mirrors the Python
f-string, Ruby #{}, PHP $var, and Crystal #{} fixes.
File-level gate for the route-extraction pass. Controllers, schemas,
views, and most application modules never declare Phoenix routes, but
analyze_file used to line-scan every .ex file anyway. Match the
DSL shape (verb + optional paren + string/unquote/atom) so common
non-route uses like Map.get( or forget do not force a full scan.
Custom route macros collected in the first pass are checked by name
separately in may_contain_phoenix_routes?.
get/post/… → its precompiled route regex. add_standard_route runs
once per verb per line of every .ex file; Regex.new there recompiled
the same 7 PCRE2 patterns on every call (~3.4M recompiles on a 2400-file
repo, the dominant scan cost). The pattern depends only on the fixed verb
set, so build it once. See add_standard_route for the shape rationale.
RFC 10008's query is deliberately absent here. Unlike Plug (which
already ships query/2), Phoenix's own router macro is still pending
(phoenixframework/phoenix#6737); adding a bare verb here — via
add_standard_route, which has no plug_route_path?-style leading-/
guard — would misread any unrelated query("literal", CapitalizedMod)
local function (a common Ecto/dispatch-helper shape) as a route. Since
a Phoenix router sits on Plug, match :query, ... already routes today
without needing this table — see match_route_methods below, which
upcases whatever verb atom it's given.
Class methods
Instance methods
Instance-side view of the same declaration. The per-file rescues live on
this base class, which has no way to name the analyzer that is running
inside them, so a skipped file could not be attributed to a tech.
Deriving it from analyzer_for keeps the name written exactly once.