// HACKER NEWS — CYBERSECURITY
ImpactGate: A merge gate that scores the structural decay AI adds
Measure and gate the structural decay a change introduces. Run it as a standalone CLI,
a git pre-commit hook, or a plugin in GitHub, GitLab, and Jenkins CI.
Structural decay is complexity accreting into existing structures. A god-method grows
another branch. A god-class gains another method. The gate scores a change against a
base (main by default) with the change-impact measure:
WMC_other is the complexity already in the container you are editing. It is measured
on the pre-change state. So importing a brand-new file or class is cheap. Nothing was
there before. Piling onto an already-heavy class is expensive. That is the decay signal.
For the reasoning behind the formula, see Measuring the Blast Radius of
Change on
the OfficeFloor blog.
When impact is too high, the gate asks you to simplify the change or refactor the code
it touches. It can warn (report only) or block (fail the build).
Or run it without installing anything, via the published image (git is bundled;
mount the repo to score at /repo):
To hack on it locally, install from a checkout instead:
Exit codes. 0 means ok or warn (the change is allowed). 2 means blocked (impact too
high under --enforcement block). 1 means a usage or environment error.
Every report also lists the files to consider for refactoring, ranked by their share
of the impact. The change-level number gates; the per-file ranking points at where the
decay is concentrating, so a file quietly growing into a god-class surfaces as a
candidate before it blocks anything.
A source file whose diff is larger than max_diff_lines (200,000 by default, in the
measure config) is almost always a generated dump or a vendored blob. The gate skips it
so it neither distorts the number nor slows scoring, and lists it under skipped so
the result is never silently wrong.