fix(lvl5): lint table parser — abra renders HEAVY box verticals (┃ U+2503); accept both; meta registry EXPECTED_NA/BACKUP_CAPABLE wording → regenerated doc table
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Found by real-abra smoke on cc-ci: hedgedoc clean → pass; +lightweight tag → fail R014. Full suite 246 passed on cc-ci venv.
This commit is contained in:
@ -16,28 +16,32 @@ import sys
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner"))
|
||||
from harness import lint as L # noqa: E402
|
||||
|
||||
# Realistic abra lint table rows (unicode box drawing, ✅/❌ marks), as captured on cc-ci.
|
||||
# Realistic abra lint table rows, as captured on cc-ci: abra renders HEAVY box-drawing
|
||||
# verticals (┃ U+2503) — the parser must match those, not just the light │.
|
||||
TABLE_OK = (
|
||||
"┏━━━━━━┳━━━━━━┓\r\n"
|
||||
"│ R001 │ compose config has expected version │ warn │ ✅ │ - │ ensure │\r\n"
|
||||
"│ R015 │ long secret names │ warn │ ❌ │ - │ reduce │\r\n"
|
||||
"│ R008 │ .env.sample provided │ error │ ✅ │ - │ create │\r\n"
|
||||
"│ R014 │ only annotated tags used for recipe version │ error │ ✅ │ - │ retag │\r\n"
|
||||
"┃ R001 ┃ compose config has expected version ┃ warn ┃ ✅ ┃ - ┃ ensure ┃\r\n"
|
||||
"┃ R015 ┃ long secret names ┃ warn ┃ ❌ ┃ - ┃ reduce ┃\r\n"
|
||||
"┃ R008 ┃ .env.sample provided ┃ error ┃ ✅ ┃ - ┃ create ┃\r\n"
|
||||
"┃ R014 ┃ only annotated tags used for recipe version ┃ error ┃ ✅ ┃ - ┃ retag ┃\r\n"
|
||||
"┗━━━━━━┻━━━━━━┛\r\n"
|
||||
"WARN secret session_secret is longer than 12 characters\r\n"
|
||||
)
|
||||
|
||||
# The light-vertical variant must parse identically (defensive: abra theme/version drift).
|
||||
TABLE_OK_LIGHT = TABLE_OK.replace("┃", "│")
|
||||
|
||||
TABLE_R014_FAIL = (
|
||||
TABLE_OK.replace(
|
||||
"│ R014 │ only annotated tags used for recipe version │ error │ ✅",
|
||||
"│ R014 │ only annotated tags used for recipe version │ error │ ❌",
|
||||
"┃ R014 ┃ only annotated tags used for recipe version ┃ error ┃ ✅",
|
||||
"┃ R014 ┃ only annotated tags used for recipe version ┃ error ┃ ❌",
|
||||
)
|
||||
+ "WARN critical errors present in hedgedoc config\r\n"
|
||||
)
|
||||
|
||||
TABLE_SKIPPED_ERROR = TABLE_OK.replace(
|
||||
"│ R014 │ only annotated tags used for recipe version │ error │ ✅ │ - │",
|
||||
"│ R014 │ only annotated tags used for recipe version │ error │ ❌ │ skipped │",
|
||||
"┃ R014 ┃ only annotated tags used for recipe version ┃ error ┃ ✅ ┃ - ┃",
|
||||
"┃ R014 ┃ only annotated tags used for recipe version ┃ error ┃ ❌ ┃ skipped ┃",
|
||||
)
|
||||
|
||||
|
||||
@ -59,6 +63,10 @@ def test_parse_table_strips_ansi():
|
||||
assert len(rows) == 4
|
||||
|
||||
|
||||
def test_parse_table_light_verticals_too():
|
||||
assert L.parse_table(TABLE_OK_LIGHT) == L.parse_table(TABLE_OK)
|
||||
|
||||
|
||||
def test_parse_table_garbage_is_empty():
|
||||
assert L.parse_table("FATA something exploded\r\n") == []
|
||||
assert L.parse_table("") == []
|
||||
|
||||
Reference in New Issue
Block a user