class

Analyzer::Python::Masonite

Inherits Analyzer::Python::PythonEngine < Analyzer < FileHelper < Reference < Object

Reference: https://docs.masoniteproject.com/features/routing

Masonite (current v4/v5 API) routes live in routes/web.py (and sibling routes/*.py modules such as routes/api.py) as a plain list assigned to ROUTES, built from classmethods on masonite.routes.Route:

Route.get/post/put/patch/delete/options(url, controller, **opts) Route.any(url, controller) -> all six verbs Route.match([methods], url, controller) Route.group([...routes...], prefix=, middleware=, name=, domain=) Route.resource(base_url, controller) -> 7 REST routes Route.api(base_url, controller) -> 5 REST-API routes Route.view(url, template, data) -> GET, no controller Route.redirect/permanent_redirect(url, new) -> GET, no controller

controller is either the documented string binding ('WelcomeController@show', defaulting to __call__ with no @) or a direct class/method reference (WelcomeController.show) — both are handled. Route.fallback(...) (a catch-all with no concrete path) and route .name(...)/.domain(...) are intentionally not modeled — they carry no attack-surface information Noir tracks.

NOTE — Masonite ≤3 used a different, now-legacy routing API: bare Get/Post/RouteGroup classes imported directly from masonite.routes (e.g. Get('/x', 'C@m'), RouteGroup([...], prefix=...)) with controllers resolved under app/http/controllers. That shape is NOT handled here; this analyzer targets the current Route.* DSL used by the official project skeleton (MasoniteFramework/cookie-cutter, app/controllers) and current docs. A legacy-style project still gets detected as Masonite (the detector only looks for masonite imports) but yields no routes from this analyzer.

Constants

ANY_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
API_RESOURCE_ACTIONS = [{["GET"], "", "index"}, {["POST"], "", "store"}, {["GET"], "/@id", "show"}, {["PUT", "PATCH"], "/@id", "update"}, {["DELETE"], "/@id", "destroy"}]

Route.api(base_url, controller) — API-style subset (no create/edit HTML forms).

HTTP_VERB_METHODS = {"get" => ["GET"], "post" => ["POST"], "put" => ["PUT"], "patch" => ["PATCH"], "delete" => ["DELETE"], "options" => ["OPTIONS"]}
RESOURCE_ACTIONS = [{["GET"], "", "index"}, {["GET"], "/create", "create"}, {["POST"], "", "store"}, {["GET"], "/@id", "show"}, {["GET"], "/@id/edit", "edit"}, {["PUT", "PATCH"], "/@id", "update"}, {["DELETE"], "/@id", "destroy"}]

Route.resource(base_url, controller) — see masonite.routes.Route.resource: seven conventional REST routes.

ROUTE_CALL_VERBS = Set {"get", "post", "put", "patch", "delete", "options", "any", "match", "group", "resource", "api", "view", "redirect", "permanent_redirect"}

Verbs recognized while scanning Route.<verb>(...) call sites. Anything else (.compile, .set_controller_locations, .fallback, .default, ...) is deliberately left unmatched.

Class methods

tech_name
Source

Instance methods

analyze
Source
tech

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.

Source