Name only the checker the keyword answers to, and file the Error near miss
Tests / vet + fmt + tests (pull_request) Successful in 1m26s
Tests / Gitea release from CHANGELOG.md (pull_request) Has been skipped

This commit is contained in:
2026-09-20 21:26:54 +02:00
parent e09e92ff03
commit ea9c1ad436
3 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -5,8 +5,8 @@
Table 2 is the whole set, read between the facility table's caption and its own. The
keyword is POSIX's severity macro less its `LOG_` prefix, lowercased, taken in the
order POSIX lists them, which `LOG_UPTO` states is the severity order; each must be a
prefix of the severity RFC 5424 numbers alike, so the two sources pin one pairing.
order POSIX lists them; each must be a prefix of the severity RFC 5424 numbers alike,
so the two sources pin one pairing.
"""
import argparse
import html
@@ -24,7 +24,7 @@ CACHE = Path(__file__).resolve().parent / "cache"
COLUMNS = ["code", "keyword", "severity"]
TABLE = re.compile(r"Table 1\.\s+Syslog Message Facilities(.*?)Table 2\.\s+Syslog Message Severities", re.S)
ROW = re.compile(r"^ +(\d) +([A-Z][a-z]+): ", re.M)
SEVERITIES = re.compile(r"severity level portion of the.*?macros:(.*?)The following shall be declared as functions", re.S)
SECTION = re.compile(r"severity level portion of the.*?macros:(.*?)The following shall be declared as functions", re.S)
MACRO = re.compile(r"\bLOG_([A-Z]+)\b")
EXPECTED = 8
@@ -37,7 +37,7 @@ def severities(text):
def keywords(page):
section = SEVERITIES.search(html.unescape(re.sub(r"<[^>]+>", "", page)))
section = SECTION.search(html.unescape(re.sub(r"<[^>]+>", "", page)))
if not section:
sys.exit("POSIX spells no severity list between its own caption and the function declarations; the page has moved")
return [m.lower() for m in MACRO.findall(section.group(1))]