Baselines
Save a JSON report on the main branch and fail the build when any score gets worse.
For an existing codebase, save a JSON report on the main branch:
poly-crap --format json --output poly-crap.json
Then compare a change against it:
poly-crap --baseline poly-crap.json --fail-regression --fail-above
Each current function is matched to the baseline by file, name, and position, with allowances for a baseline written from a different root. Every function gets one status:
regressed: the score rose by more than--epsilon, default0.01.improved: the score fell by more than--epsilon.unchanged: neither. The table hides these rows; JSON keeps them.new: nothing in the baseline matched.moved: the same function, found in another file.removed: a baseline function nothing matched.
Changes since baseline
Status Score Delta Language Symbol Location Uncovered
regressed 6.0 +5.00 python run ./app.py:4 6-8
new 1.0 N/A python helper ./app.py:9
1 regression found.
1 of 3 functions exceeds CRAP threshold 5.0.
A baseline written by an older poly-crap may not parse; regenerate it.
--allow applies to the baseline too, so an allowed function never appears as
removed.