chore: Konsistenz-Check für die ROADMAP (lesend)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GmHhg5YdSXUmKzjHCaEWQp
This commit is contained in:
48
scripts/roadmap_konsistenz.py
Normal file
48
scripts/roadmap_konsistenz.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Konsistenz-Check der ROADMAP.md (lesend). Aufruf: python3 scripts/roadmap_konsistenz.py ROADMAP.md
|
||||||
|
# Prüft: doppelte IDs, erledigt aber offen, Release mit erledigten Punkten ohne Fertig-Vermerk, nächste freie ID.
|
||||||
|
import re,sys,collections
|
||||||
|
s=open(sys.argv[1],encoding="utf-8").read()
|
||||||
|
L=s.split("\n")
|
||||||
|
ids=re.findall(r"#(1\d{3})\b",re.sub(r"Nächste freie ID: #\d+","",s))
|
||||||
|
# Abschnitte
|
||||||
|
sec={}; cur=None
|
||||||
|
for l in L:
|
||||||
|
m=re.match(r"^## (\d)\.",l)
|
||||||
|
if m: cur=m.group(1); sec.setdefault(cur,[]).append(l); continue
|
||||||
|
if cur: sec[cur].append(l)
|
||||||
|
def ids_in(lines): return set(re.findall(r"#(1\d{3})\b","\n".join(lines)))
|
||||||
|
prob=[]
|
||||||
|
# 1 Todo-Einträge (Abschnitt 4), Erledigt-Block darin
|
||||||
|
todo=sec.get("4",[]);
|
||||||
|
erl_idx=next((i for i,l in enumerate(todo) if l.startswith("**Erledigt (einzeln)**")),len(todo))
|
||||||
|
open_todo=[l for l in todo[:erl_idx] if re.match(r"^- \[#1\d{3}\]",l)]
|
||||||
|
done_todo=[l for l in todo[erl_idx:] if re.match(r"^- \[#1\d{3}\]",l)]
|
||||||
|
oid=[re.match(r"^- \[#(1\d{3})\]",l).group(1) for l in open_todo]
|
||||||
|
did=[re.match(r"^- \[#(1\d{3})\]",l).group(1) for l in done_todo]
|
||||||
|
for x in set(oid)&set(did): prob.append(f"#{x} steht offen UND erledigt")
|
||||||
|
for x,c in collections.Counter(oid).items():
|
||||||
|
if c>1: prob.append(f"#{x} doppelt offen")
|
||||||
|
# erledigt im offenen Block
|
||||||
|
for l in open_todo:
|
||||||
|
if re.search(r"erledigt am \d",l): prob.append(f"erledigt, aber im offenen Block: {l[:60]}")
|
||||||
|
# Release-Zeilen (Abschnitt 6)
|
||||||
|
rel=[l for l in sec.get("6",[]) if l.startswith("**")]
|
||||||
|
for l in rel:
|
||||||
|
name=re.match(r"^\*\*([^*]+)\*\*",l).group(1)
|
||||||
|
rids=set(re.findall(r"#(1\d{3})\b",l))
|
||||||
|
for x in rids:
|
||||||
|
if x in set(did) and "Fertig" not in l and "Abgeschlossen" not in l and "erledigt" not in l.lower():
|
||||||
|
prob.append(f"Release {name}: #{x} ist erledigt, Release nicht als fertig markiert")
|
||||||
|
if x in set(oid) and False: pass
|
||||||
|
# Doppelte IDs über Stand/Todo hinweg (ein Punkt, eine Zeile)
|
||||||
|
defs=collections.Counter(re.findall(r"^- \[#(1\d{3})\] \*\*",s,re.M)+re.findall(r"^\| #(1\d{3}) \|",s,re.M)+re.findall(r"^- \[#(1\d{3})\] [A-ZÄÖÜ]",s,re.M))
|
||||||
|
for x,c in defs.items():
|
||||||
|
if c>1: prob.append(f"#{x} mehrfach definiert ({c}x)")
|
||||||
|
# nächste freie ID
|
||||||
|
m=re.search(r"Nächste freie ID: #(\d+)",s); nxt=int(m.group(1)) if m else None
|
||||||
|
mx=max(int(x) for x in ids)
|
||||||
|
if nxt is not None and nxt<=mx: prob.append(f"Nächste freie ID #{nxt} ist nicht größer als die höchste genutzte #{mx}")
|
||||||
|
print(f"IDs genutzt: {len(set(ids))}, höchste #{mx}, nächste frei #{nxt}")
|
||||||
|
print(f"offene Todos: {len(oid)}, erledigte: {len(did)}")
|
||||||
|
print("PROBLEME:" if prob else "OK, keine Widersprüche gefunden")
|
||||||
|
for p in prob: print(" -",p)
|
||||||
Reference in New Issue
Block a user