Analyzer::Crystal::Cli
Inherits CliEndpointSupport < Analyzer < FileHelper < Reference < Object
Surfaces the command-line attack surface of Crystal programs as cli://
endpoints: stdlib OptionParser / ARGV / ENV plus the clim, admiral and
commander shards. One endpoint per (sub)command, params flag/argument/env,
merged by URL. Line-scan; subclasses Analyzer directly.
Constants
ADM_ARG = /^\s*define_argument\s+([A-Za-z_]\w*)/
ADM_FLAG = /^\s*define_flag\s+([A-Za-z_]\w*)/
ADM_SUB = /\bregister_sub_command\s+([A-Za-z0-9_]+)/
ARGV_INDEX = /\bARGV\s*\[\s*(\d+)\s*\]/
CLIM_ARGUMENT = /^\s*argument\s+["']([A-Za-z0-9][\w-]*)/
CLIM_OPTION = /^\s*option\s+["'](-{1,2}[A-Za-z0-9][\w-]*)/
CLIM_SUB = /^\s*sub\s+["']([A-Za-z0-9][\w-]*)["']/
ENV_FETCH = /\bENV\.fetch\s*\(\s*["']([^"']+)["']/
ENV_INDEX = /\bENV\s*\[\s*["']([^"']+)["']\s*\]/
MARKERS = /\bOptionParser\.(?:parse|new)\b|\bARGV\s*\[\s*\d+\s*\]|<\s*Clim\b|<\s*Admiral::Command\b|\bCommander::Command\b|\brequire\s+"(?:clim|admiral|commander)"/
OPT_LONG = /\.on\s*\(?[^)]*?["'](-{2}[A-Za-z0-9][\w-]*)/
OPT_SHORT = /\.on\s*\(\s*["'](-[A-Za-z0-9])(?:["' =]|\))/
OPTION_PARSER = /\bOptionParser\.(?:parse|new)\b/
WEB_RE = /\brequire\s+"(?:kemal|amber|lucky|grip|marten)"|HTTP::Server\.new|\bKemal\b|Amber::Server/
Class methods
tech_name
SourceInstance methods
analyze
Sourcetech
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.