]> git.ipfire.org Git - thirdparty/qemu.git/commit
qapi: Add documentation format validation
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Fri, 31 Oct 2025 18:31:29 +0000 (21:31 +0300)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 4 Nov 2025 12:55:27 +0000 (13:55 +0100)
commit8107ba47fd78bcf8c3206de42dbfb5ba8184d706
tree538d7175d6680ed5e59df4c85f461bb60955d4bf
parent201a38d12b9dbbe190c6b6c757d979e656ebeeac
qapi: Add documentation format validation

Add explicit validation for QAPI documentation formatting rules:

1. Lines must not exceed 70 columns in width (including '# ' prefix)
2. Sentences must be separated by two spaces

Example sections and literal :: blocks (seldom case) are excluded, we
don't require them to be <= 70, that would be too restrictive. Anyway,
they share common 80-columns recommendations (not requirements).

Add two simple tests, illustrating the change.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20251031183129.246814-1-vsementsov@yandex-team.ru>

The detection of example and literal blocks isn't quite correct, but
it works well enough, and we can improve on top.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Comments, error messages, and test file names tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/parser.py
tests/qapi-schema/doc-bad-space-between-sentences.err [new file with mode: 0644]
tests/qapi-schema/doc-bad-space-between-sentences.json [new file with mode: 0644]
tests/qapi-schema/doc-bad-space-between-sentences.out [new file with mode: 0644]
tests/qapi-schema/doc-long-line.err [new file with mode: 0644]
tests/qapi-schema/doc-long-line.json [new file with mode: 0644]
tests/qapi-schema/doc-long-line.out [new file with mode: 0644]
tests/qapi-schema/meson.build