Files
troupe-standup/wizard-work/ledger/workqueue-census/check_dash.py
T

23 lines
691 B
Python

import re
import collections
text = open('/root/troupe-standup/WORK-QUEUE.md', encoding='utf-8').read()
print('line endings:', set(c for c in text if c in '\r\n'))
HEADING_RE = re.compile(r'^##\s+(Q\d+)\s+—\s+(.*)$', re.M)
heads = HEADING_RE.findall(text)
print('matched:', len(heads))
cnt = collections.Counter(h[0] for h in heads)
dups = sorted(q for q, c in cnt.items() if c > 1)
print('dup labels:', dups)
print('distinct:', len(cnt))
all_q = [l for l in text.splitlines() if l.startswith('## Q')]
print('all ## Q lines:', len(all_q))
matched_set = set(h[0] for h in heads)
for l in all_q:
q = l.split()[1]
if q not in matched_set:
print('MISSING:', repr(l[:120]))