44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import re
|
|
SRC = "/root/troupe-standup/WORK-QUEUE.md"
|
|
text = open(SRC, encoding="utf-8").read().splitlines()
|
|
TOP = re.compile(r"^## ")
|
|
Q = re.compile(r"^## Q(\d+)\s?(.*)$")
|
|
STCOL = re.compile(r"^\*\*\s*Status\s*:(.*)$")
|
|
STCOM = re.compile(r"^\*\*\s*Status\s*,(.*)$")
|
|
|
|
# Build blocks
|
|
blocks = [] # list of (q, title, lines)
|
|
cur = None
|
|
for i, raw in enumerate(text):
|
|
line = raw.rstrip()
|
|
m = Q.match(line)
|
|
if m:
|
|
if cur:
|
|
blocks.append(cur)
|
|
cur = {"q": int(m.group(1)), "title": m.group(2).strip().lstrip("—").strip(), "start": i, "end": None}
|
|
continue
|
|
if TOP.match(line):
|
|
if cur:
|
|
blocks.append(cur)
|
|
cur = None
|
|
continue
|
|
if cur is not None:
|
|
cur["end"] = i
|
|
if cur:
|
|
blocks.append(cur)
|
|
for b in blocks:
|
|
b["end"] = b["end"] if b["end"] is not None else len(text)
|
|
|
|
print("total blocks:", len(blocks))
|
|
missing_col = []
|
|
missing_com = []
|
|
for b in blocks:
|
|
has_col = any(STCOL.match(text[i]) for i in range(b["start"], b["end"]))
|
|
has_com = any(STCOM.match(text[i]) for i in range(b["start"], b["end"]))
|
|
if not has_col:
|
|
missing_col.append(b["q"])
|
|
if not has_com:
|
|
missing_com.append(b["q"])
|
|
print("blocks without 'Status:' colon:", sorted(set(missing_col)))
|
|
print("blocks without 'Status,' comma:", sorted(set(missing_com)))
|