Analyzer::CSharp::Cli
Inherits CliEndpointSupport < Analyzer::CSharp::Common < Analyzer < FileHelper < Reference < Object
Surfaces the command-line attack surface of C# programs as cli://
endpoints: one endpoint per (sub)command with named options
(param_type "flag"), positional arguments ("argument") and consumed
environment variables ("env"). Covers Main(string[] args) /
GetCommandLineArgs / GetEnvironmentVariable plus System.CommandLine,
CommandLineParser, CliFx, Spectre.Console.Cli,
McMaster.Extensions.CommandLineUtils and Cocona.
Line-scan analyzer (Go/Ruby/Rust CLI house style) merging endpoints by URL. Subclasses Analyzer directly (there is no C# engine) and reuses Common.csharp_test_path? to skip test files.
Constants
McMaster / Cocona: [Argument(0)] / [Argument(0, "name")] /
bare [Argument] (Cocona lambda params). Body may hold an explicit
quoted name; when absent we fall back to the annotated property or
parameter name (same line or the line right below).
Marker strings must not substring-match unrelated code: a bare
"CommandLine" would also hit Environment.GetCommandLineArgs (or any
comment), qualifying a web app as a framework CLI and leaking its env
reads. CommandLineParser is matched via its using CommandLine /
CommandLine.Parser namespace forms instead (same shape the cs_cli
detector uses). Cocona is matched via its using Cocona / CoconaApp.*
forms for the same reason ("Cocona" alone is specific enough as a
substring, but we keep the same regex shape for consistency).
builtin.
Parenthesized body is optional so a bare [Option] (McMaster/Cocona,
name taken from the annotated member) is matched too.
Trailing "type name" right after a matched attribute's tail (an optional leftover "]" is skipped first since Option/Argument attr regexes above don't always consume it).
System.CommandLine (builder). Variable-mapped: a command/option binds to its receiver variable, so root options declared after a subcommand aren't mis-attributed to the subcommand.
Attribute-driven libs (CommandLineParser / CliFx / Spectre / airline-ish / McMaster.Extensions.CommandLineUtils / Cocona).
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.