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
+1 -1
View File
@@ -1237,7 +1237,7 @@ the Development section below, and who ships a register the four above then draw
- **`misc.loglevel` is a table keyed by the code, rendering POSIX's keyword.** A flat
list of names carries neither the code a PRI encodes nor a selector reaching it, and
goal 1 draws the two as one fact. RFC 5424 spells the severity `Informational`,
which no syslog, PSR-3 or `slog` checker accepts, so the shipped spelling is the one
which no syslog checker accepts, so the shipped spelling is the one
a configuration writes, `info`, and the RFC's name stays the `severity` column. The
code and the keyword take the two selector slots, so `misc.loglevel[Error]` misses.
- **`misc.tld` keys carry the leading dot, where other tables key on a bare code.**
+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))]
+3 -2
View File
@@ -110,8 +110,9 @@ by a `data-import/` script, as README goal 10 asks.
`misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name"
and stop there, where a case-insensitive match could name the row that exists, and a
table with no `name` column could say it selects by key alone. `misc.tld[se]` misses
on the leading dot its keys carry rather than on case, so the near miss is worth
naming whatever shape it takes.
on the leading dot its keys carry rather than on case, and `misc.loglevel[Error]`
although the table carries `Error` in a column, so the near miss is worth naming
whatever shape it takes.
- Let a table column carry a `datatype`, so `--format json` writes
`"safe": true` and `--format sql` a boolean rather than the text `'true'`. Today only
a JSON field takes one, so `misc.httpmethod`'s booleans are typed in Go and text