Analyzer::Ruby::Grape
Inherits Analyzer::Ruby::RubyEngine < Analyzer < FileHelper < Reference < Object
Constants
Grape::API is absent from almost every .rb file in a large repo,
so String#includes? scanned each one end to end. One precompiled
matcher via content_matches? is the same test in a single pass.
class <Child> < <Super> declaration matcher (single capture: Super).
Full form capturing both Child and Super for the inheritance graph.
A route or prefix statement whose options continue on the next line
(namespace 'conans/:name', / requirements: {...} do).
%w[a b].each do |x|, [:a, :b].each do |x| and
{ "a" => 1, "b" => 2 }.each do |x, y| over a literal receiver.
mount Child / mount Child => "/path" (capture 2: the mount path).
build_grape_index's whole-tree pre-pass gate OR-ed two
String#includes? scans over every file's content as a standalone
boolean gate. Folded into one precompiled union so it costs a single
PCRE2 match instead of up to two naive substring scans per file.
resource source_type.pluralize do outside a static loop: the name is
only known at runtime, so the segment becomes a {source_type}
placeholder instead of vanishing from the path.
Crystal recompiles an interpolated regex literal (/^#{verb}.../)
on every evaluation — ~11000x slower than a precompiled one — so
matching the verb DSL inside the per-line loop used to recompile
14 regexes for every line of every Grape file. Build the per-verb
patterns once at load time instead. _WITH_PATH matches
get '/users' do (capturing the path literal/symbol) and the
path-less get urgency: :low do (options only); _BARE_DO matches
the path-less get do form.
Unrolling is multiplicative and noir scans untrusted repos, so it is bounded (real Grape loops are a handful of literals, one level deep).
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.