Files

21 lines
917 B
Python

import collections, glob, json, pathlib, re, sys
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "bin"))
from review_replay.rounds import recorded_findings
cand=sys.argv[1]
for vr in sys.argv[2:]:
c=collections.Counter()
for p in sorted(glob.glob(f"results/{cand}/{vr}/*.json")):
r=json.load(open(p))
if "error" in r: continue
name=pathlib.Path(p).stem.split("--")[1]
body="\n".join(r["written"].values()) or r["reply"]["result"]
if name=="merged":
sec=None
for part in re.split(r"(?m)^#{1,3} +", body):
head=part.split("\n",1)[0].lower()
for k in ["stability","product-owner","prose","architecture","principles"]:
if head.startswith(k): sec=k
c[sec]+=len(recorded_findings(part))
else: c[name]+=len(recorded_findings(body))
print(vr, dict(c))