Analyzer::Groovy::Cli
Inherits CliEndpointSupport < Analyzer < FileHelper < Reference < Object
Surfaces the command-line attack surface of Groovy programs as cli://
endpoints: the built-in CliBuilder (and picocli @Option), JCommander
(@Parameter / addCommand subcommands) and Commons CLI (Option.builder /
addOption), plus System.getenv. Line-scan; attribution for JCommander
subcommands additionally uses a per-file pre-scan (variable -> class ->
command name) so it can resolve both the inline
addCommand("name", new Class()) form and the more common
declare-then-register addCommand("name", instance) form. Root
attribution otherwise (CliBuilder/Commons CLI are flat), merged by URL.
NOTE: like CliBuilder, this is a per-file analyzer. When a JCommander
subcommand class lives in its own file (registration call in one file,
@Parameter fields in another), the class-to-command mapping built here
won't span files, so that subcommand's fields fall back to that file's
own root endpoint instead of being attributed under the real
subcommand's URL. A cross-file pre-pass would be needed to close that
gap; not attempted here.
Constants
--- Commons CLI ------------------------------------------------------
One precompiled Regex.union scan (PCRE2 JIT) replaces three separate
String#includes? scans of the same buffer -- Crystal's includes? is
not Boyer-Moore accelerated, so a single regex pass over the downcased
path is cheaper than three. Equivalent to the OR-of-substrings it
replaces (union escapes each literal).
--- JCommander -----------------------------------------------------
Gated on library-specific constructs only (never a bare @Parameter,
which is too generic on its own) so unrelated annotations/classes
named similarly don't light this up.
CliBuilder methods that are not option definitions.
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.