ViolationBaseline

Pure support for the committed baseline (a.k.a. freeze) workflow.

A baseline is a set of violation fingerprints captured from a known state of the project and committed to the repository. On later runs, aalekhCheck suppresses every violation already in the baseline and fails only on genuinely new ones. This lets a team adopt strict rules on a messy codebase immediately - the existing debt is frozen, and the build blocks only regressions.

This object is deliberately I/O-free: the Gradle layer reads and writes the baseline file and calls these functions. That keeps baseline logic unit-testable in milliseconds.

Types

Link copied to clipboard
data class Result(val newViolations: List<Violation>, val baselinedCount: Int)

The outcome of apply.

Functions

Link copied to clipboard
fun apply(violations: List<Violation>, fingerprints: Set<String>): ViolationBaseline.Result

Filters violations against a set of baseline fingerprints.

Link copied to clipboard
fun fingerprint(violation: Violation): String

A stable identity for a violation, independent of run timestamp. Two violations share a fingerprint when they are the "same" problem: same rule, same offending edge or module.

Link copied to clipboard

The fingerprints to persist for violations. INFO violations are advisory and never fail the build, so they are excluded from the baseline. The result is de-duplicated and sorted so the committed file is stable and diffs cleanly.