# ImpactGate

> A merge gate CLI and CI plugin that scores the structural complexity cost of every code change, flagging changes that pile complexity onto already-complex code before they become costly rewrites.

ImpactGate is an open-source tool from the makers of OfficeFloor that measures the "blast radius" of each code change by weighting new complexity against the complexity already present in the files being edited. It runs as a standalone CLI, a git pre-commit hook, or a CI plugin for GitHub Actions, GitLab CI, and Jenkins, and is available on PyPI and as a Docker image. The project is licensed under Apache-2.0 and is currently at version v0.3.2.

## What It Is

ImpactGate is a change-impact gate for software teams — particularly those using AI coding assistants — that want to catch structural decay before it compounds into a god class or an unmaintainable codebase. Rather than scoring the static state of code (as tools like SonarQube do), it scores the **marginal cost** of each change: how much complexity is being added to code that is already complex. The core formula is:

```
impact = files_changed × Σ max(WMC_other, 1) × CC × Δlines
```

Where `WMC_other` is the weighted method complexity already in the container being edited (measured before the change), `CC` is the cyclomatic complexity of the touched functions, and `Δlines` is how much the change adds. Adding a brand-new file scores near zero; adding a complex method to an already-heavy class scores high.

## The Problem It Targets

The project's thesis is that AI coding assistants are very good at generating complexity. They keep piling logic into existing code because complexity does not slow them down — a god method grows another branch, a god class gains another method, and the code still works. The decay is silent until the system reaches a point where no human (or AI) can safely maintain it. ImpactGate makes that decay visible at the moment it is added, one commit at a time, while the fix is still a small refactor rather than an expensive rewrite.

## How the Grading Curve Works

A raw threshold is hard to calibrate because impact varies by orders of magnitude across languages and projects. ImpactGate addresses this by grading each change by **percentile** against a distribution that blends two sources:

- A **seed prior**: per-language percentile tables built from a corpus study across 20 open-source repositories, with a pooled fallback for languages not in the table.
- A **project baseline**: the repo's own per-change distribution, walked from the merged mainline history.

The blend weights the project by `w = n / (n + K)`, where `n` is the number of landed changes and `K` (default 200) controls how much history is needed before the project's own distribution outweighs the seed. A fresh repo grades on the seed alone; a deep history leans on itself.

## Language Support and Integration Footprint

Complexity is parsed per function by the `lizard` library, making ImpactGate language-agnostic across Java, C#, C, C++, JavaScript, TypeScript, Python, Go, Kotlin, Swift, Ruby, PHP, Rust, Scala, Objective-C, Lua, and TTCN-3. Mixed-language repos are scored uniformly. The grading curve is calibrated per language for Python, Java, TypeScript, C#, JavaScript, C, Scala, and Go; other languages fall back to the pooled cross-language distribution.

Integration options include:
- **pip install** (`pip install impact-gate`) for the CLI
- **Docker image** on GHCR (git bundled, mount the repo at `/repo`)
- **GitHub Actions** via `officefloor/ImpactGate@v0` with sticky PR comments
- **GitLab CI** via a ready-made job in `ci/gitlab-ci.yml`
- **Jenkins** via a pipeline snippet in `ci/Jenkinsfile`
- **git pre-commit hook** via `impact-gate install-hook` or the pre-commit framework

## Update: v0.3.2

The latest release is v0.3.2, published on 2026-09-17, with the repository last pushed on 2026-09-17. The project was created in August 2026 and has been actively updated since. The homepage references v0.3.0 while the GitHub release page shows v0.3.2 as the current version, indicating rapid iteration. The project explicitly documents its limits — the corpus study found the measure does not beat file size as a bug predictor, so the tool does not claim defect prediction, only structural decay gating.

## Features
- Change-impact scoring weighted by pre-existing complexity (WMC × CC × Δlines formula)
- Percentile grading curve blending a seed prior and project baseline
- Warn or block enforcement modes
- Sticky PR/MR comments on GitHub and GitLab
- GitHub Actions integration
- GitLab CI integration
- Jenkins pipeline integration
- Git pre-commit hook (native and pre-commit framework)
- CLI with staged, worktree, and branch-range modes
- JSON, text, and markdown output formats
- Per-file refactoring candidates ranked by impact share
- Configurable thresholds via .impact-gate.yml
- CI-adjustable tolerance multiplier
- Baseline generation from merged mainline history
- Language-agnostic scoring via lizard (17+ languages)
- Per-language calibrated grading curves
- Docker image on GHCR
- PyPI package
- Skips generated/vendored blobs automatically

## Integrations
GitHub Actions, GitLab CI, Jenkins, pre-commit framework, Docker, PyPI, lizard (complexity parser)

## Platforms
CLI, API, DEVELOPER_SDK

## Pricing
Open Source

## Version
v0.3.2

## Links
- Website: https://impactgate.officefloor.net
- Documentation: https://github.com/officefloor/ImpactGate#readme
- Repository: https://github.com/officefloor/ImpactGate
- EveryDev.ai: https://www.everydev.ai/tools/impactgate
