forge: check_lint Counter tally DRY + smoke_check_monotonic probe refactor with fixed verifier fixture

This commit is contained in:
forge committed 2026-10-25 03:18:27 +00:00
1 parent d6d8eeef0c
commit 4f76eaa9d1
17 files changed
+18482 -1

No files matched your search

+8 -1
View File
@@ -72,6 +72,7 @@ import json
import os
import re
import sys
from collections import Counter
# --------------------------------------------------------------------------
# Extraction -- mirrors ralph-loop.sh line 24:
@@ -442,13 +443,19 @@ def report(runs: list[dict], as_json: str | None, quiet: bool,
summary["unknown"] += 1
if g["class"] == "MISSING":
summary["no_check_ever"] += 1
summary["classes"][g["class"]] = summary["classes"].get(g["class"], 0) + 1
if g["cross_check"] == "GREEN_BY_CONSTRUCTION":
summary["green_by_construction"] += 1
elif g["cross_check"] == "GREEN_DESPITE_FORMATTING":
summary["green_despite_formatting"] += 1
if g["extraction_matches_runner"] is False:
summary["extraction_mismatches"] += 1
# `collections.Counter` replaces the hand-rolled tally loop
# (`summary["classes"][g["class"]] = summary["classes"].get(g["class"], 0) + 1`):
# Counter reads a missing key as 0, so `dict(Counter(...))` yields the same
# {class: n} mapping in first-appearance order. Re-assigning the existing
# key keeps its position in `summary`, so the SUMMARY repr below and the
# json.dump payload are both byte-identical to the pre-refactor output.
summary["classes"] = dict(Counter(g["class"] for g in graded))
if not quiet:
print_rules()