class

Analyzer::R::Plumber

Inherits Analyzer < FileHelper < Reference < Object

Constants

CLIENT_PARAM_NAME_RE = /\A(?:[A-Za-z][A-Za-z0-9._]*|\.(?![0-9.])[A-Za-z0-9._]*)\z/

A name that can stand for something a client actually sends. Rules out the variadic ... (and ..1, ..2), which both the formals parser and PARAM_ANNOTATION accept and which used to be emitted verbatim as a parameter named ..., plus leading-digit/dash tokens that are not identifiers at all — what those really signal is that the argument list did not parse.

FUNCTION_DECLARATION = /\bfunction\s*\(([^)]*)\)/

Matches R function declaration: function(...)

HTTP_METHODS = Set {"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}
INJECTED_ARGS = Set {"req", "res"}

Arguments plumber injects into a handler rather than reading off the request. function(req, res, msg = "") is the shape the official plumber template ships with, so reporting req/res as client-supplied parameters put two phantom entries on almost every real endpoint — and, for a POST, two phantom JSON body fields in the rendered request.

PARAM_ANNOTATION = /@param\s+([A-Za-z0-9_.-]+)(?:\s+(.*))?/i

Matches lines like: #* @param name Description

PROGRAMMATIC_DOLLAR = /\$([a-z]+)\s*\(\s*["']([^"']+)["']/i

r$get("/path", handler)

PROGRAMMATIC_DOLLAR_HANDLE = /\$handle\s*\(\s*["'](GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)["']\s*,\s*["']([^"']+)["']/i

r$handle("GET", "/path", handler)

PROGRAMMATIC_HANDLE = /\bpr_handle\s*\(\s*[^,]+,\s*["'](GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)["']\s*,\s*["']([^"']+)["']/i

pr_handle(pr, "GET", "/path", handler)

PROGRAMMATIC_PIPELINE = /\bpr_(get|post|put|delete|patch|head|options)\s*\(\s*["']([^"']+)["']/i

Programmatic routes: pr_get("/path", handler)

ROUTE_ANNOTATION = /@(get|post|put|delete|patch|head|options)\s+(\S+)/i

Matches lines like: #* @get /path or #* @post /path

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