diff options
Diffstat (limited to 'proposals.py')
-rwxr-xr-x | proposals.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/proposals.py b/proposals.py index 86b9a8f..bd8c9ad 100755 --- a/proposals.py +++ b/proposals.py @@ -48,6 +48,19 @@ def eprint(*args): print(*args, file=sys.stderr) +def is_stub(doc): + if any( + doc.ifilter_templates(matches=lambda t: t.name.matches('Archived proposal')) + ): + return False + + if not any(doc.ifilter_headings()): + # detect proposals without headings as stubs + return True + + return False + + for page in find_proposals(): page_title = page['title'] text = page['revisions'][0]['slots']['main']['content'] @@ -70,13 +83,9 @@ for page in find_proposals(): if status: status = status.lower() - archived = doc.filter_templates( - matches=lambda t: t.name.matches('Archived proposal') - ) - - if not doc.filter_headings() and not archived: + if is_stub(doc): if status in ('approved', 'rejected'): - eprint(f'WARNING no headings found for {status} proposal', page['title']) + eprint(f'WARNING {status} proposal is a stub', page['title']) else: eprint('skipping stub', page['title']) continue |