# ImpactGate catches code complexity before it becomes a problem

> A merge gate that flags changes adding complexity to already complex code, stopping god classes before they form.
- Title: ImpactGate catches code complexity before it becomes a problem
- Summary: A merge gate that flags changes adding complexity to already complex code, stopping god classes before they form. ImpactGate measures the marginal cost of…
- Keywords: impactgate, code review, github, gitlab, jenkins, static analysis, complexity measurement, merge gate, officefloor, ci/cd, git hooks, sonarqube
- Source: GitHub — https://github.com/officefloor/ImpactGate
- Read time: 2 min
- Topics: impactgate, code review, github, gitlab, jenkins, static analysis, complexity measurement, merge gate, officefloor, ci/cd, git hooks, sonarqube
## Catching complexity before it compounds
ImpactGate flags changes that pile complexity onto already complex code. It runs as a CLI tool, git hook, or plugin for GitHub, GitLab, and Jenkins.
## The gradual decay pattern
A class gains one method, then another, then another. Each change looks reasonable alone, but over dozens of edits the class ends up doing five jobs.

> That slow accretion is what we call structural decay (also considered cohesive erosion).
## How the impact formula works
Impact equals files changed times the sum of existing complexity times cyclomatic complexity times changed lines. It scores changes against a base branch.
## Existing complexity is the key
Adding a new file is cheap because there's nothing there to make worse. Adding a complex method to an already heavy class is expensive.

> WMC_other is the complexity that was already in the file or class you are editing, measured before your change.
## Different from SonarQube
SonarQube scores the state of code. ImpactGate scores the marginal cost of a change, weighted by what it lands on.

> It's the increment that turns a heavy class into a god class nobody can safely edit.
## Works across 17 languages
The tool is language agnostic, scoring Java, C#, Python, Go, JavaScript, TypeScript, Rust, and ten more languages the same way throughout.
## Three scoring modes
Score staged changes before commit, uncommitted edits against HEAD, or committed branches against main for CI and PR review.
## Files ranked for refactoring
Every report lists files to consider refactoring, ranked by their share of impact. It surfaces god classes before they block anything.
## Grade against a distribution curve
Instead of guessing a threshold, grade changes by percentile against a distribution. The tool blends a seed prior with your project's own history.

> A raw threshold is hard to set. A typical change's impact varies by orders of magnitude across languages and projects.
## Configure with a YAML file
Set warn and block thresholds, enforcement mode, and curve settings in a config file at your repo root. CLI flags override the file.
## GitHub Actions integration
Add a workflow that scores PR branches and posts results as a sticky comment. In block mode, the job fails when impact exceeds the threshold.
## GitLab and Jenkins support
GitLab CI gets a ready made job that posts sticky notes to merge requests. Jenkins gets a pipeline snippet that archives reports.
## Key takeaway

ImpactGate measures the marginal cost of code changes weighted by existing complexity, catching structural decay while it's still cheap to fix.