diff --git a/scripts/review-levels.py b/scripts/review-levels.py index 31c2745..395744c 100755 --- a/scripts/review-levels.py +++ b/scripts/review-levels.py @@ -8,7 +8,8 @@ Usage: The first form reads the Forgejo API (token in $FORGEJO_TOKEN, else ~/.forgejo-token; read-only calls) and prints each merged PR of the range with its trial level (pilot document, section 4.3) and its REVIEW.md level, -then the distributions for the 39 reference PRs and for the whole range. +then the distributions for the 39 reference PRs and for the whole range +(a set with no PR in the range is skipped). --check compares the patterns of this script with the first column of the Haut table of REVIEW.md and exits 1 if they differ: a PR that changes the Niveaux section updates this script in the same diff. @@ -383,6 +384,10 @@ def main(): print(f"#{n}\t{'ref' if n in REF39 else ' '}\t{trial}\t{level}\t{'; '.join(triggers)}") for label, keep in (("39 reference PRs", lambda n: n in REF39), (f"{len(rows)} PRs #{first}-#{last}", lambda n: True)): sel = [r for r in rows if keep(r[0])] + if not sel: + # a range that holds none of them, such as "491 491" + print(f"{label}: none in this range") + continue for col, name in ((1, "trial"), (2, "REVIEW.md")): counts = {lvl: sum(1 for r in sel if r[col] == lvl) for lvl in ("bas", "normal", "haut")} share = 100 * counts["haut"] / len(sel)