Skip to content

Embed the nilaway analyzer - #38

Merged
nnutter merged 5 commits into
analysis-starship-falconfrom
analysis-brick-cortex
Nov 5, 2026
Merged

nnutter merged 5 commits into
analysis-starship-falconfrom
analysis-brick-cortex

Conversation

@nnutter

@nnutter nnutter commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

No description provided.

The driver registered the flags of an analyzer against the global
command line. A test cannot observe that registration without starting
the process, because the global flag set holds every flag of the test
binary.

Pass the flag set in. Extraction of a function is the refactoring; the
caller still passes flag.CommandLine, so no flag changes.

Change-Id: I7e9778bdd0fbef324e8f535a2b58f44c94eb0ff6
An embedded analyzer can keep its configuration on a required analyzer.
NilAway reads -include-pkgs from its config analyzer, which is a
requirement of the analyzer that reports the diagnostics. Only the roots
of the analyzer graph reached the command line, so that configuration
had no flag at all.

Walk the requirement graph and register the flags of every analyzer in
it. Only a root gets an enable flag: a required analyzer runs because a
root needs it, so it has nothing to disable. The help for an analyzer
now lists the flags of its requirements, which is where a user looks
when -flags shows an unfamiliar prefix.

Change-Id: Id050af76326966266b5fa7dfb6cb4dcbb4e65d23
NilAway is the analyzer that constable needs the driver change for: its
configuration lives on a required analyzer, so -include-pkgs and
-pretty-print had no flag before.

NilAway pretty-prints a multi-line explanation by default, with color
when the terminal supports it. constable writes one diagnostic per line,
so the adapter clears that default. A flag still turns it on.

NilAway reads every dependency, including the standard library, unless
it is told which packages to analyze. That costs seconds and gigabytes,
and it reports flows that the analyzed repository cannot fix. The hook
passes -nilaway_config.include-pkgs, and the README explains the flag.

Change-Id: Id260935d2b7022737291a144cf55c23d7ff468a7
The adapter tests prove that each analyzer reports and that the wrapper
drops a generated file. They do not prove that the binary runs the
analyzer, because analysistest never reaches cmd/constable.

Run the built binary. One test reads the flag list, which shows that a
flag of a required analyzer reaches the command line. One test makes
NilAway silent through -nilaway_config.include-pkgs and then non-silent
without it, which shows that the analyzer reads the value. One test
keeps a violation of each embedded analyzer in a generated file and
expects no output.

Change-Id: I2d7c3e851de3e8fb2141cd6afa903aa05239c153
A reader needs to know that constable now runs four analyzers that it
does not own, that each keeps its upstream flag prefix, and that a
prefix can name a required analyzer instead of the one that reports.

The nilaway section carries the flag that the hook passes, so a reader
who runs constable by hand gets the same cost and the same set of
packages that the hook analyzes.

Change-Id: I094b462e21f88a860d23a5998c3f25670a0ea2e4
@nnutter
nnutter added this pull request to stack #41 November 5, 2026 07:46
@nnutter nnutter changed the title analysis brick cortex Embed the nilaway analyzer Nov 5, 2026
@nnutter
nnutter merged commit 30a547d into master Nov 5, 2026
3 checks passed
@nnutter
nnutter deleted the analysis-brick-cortex branch November 5, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant