summary refs log tree commit diff stats
path: root/scripts/qapi/parser.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-02-16 15:58:34 +0100
committerMarkus Armbruster <armbru@redhat.com>2024-02-26 10:43:56 +0100
commitd23055b8db88a54b372ebbbffe3681169d2a767a (patch)
treed1c9331cc9a6c44000043d8f2b8f03f37b8ca2da /scripts/qapi/parser.py
parent56c64dd60aebb9c856ab63de74c9e81acd079436 (diff)
downloadfocaccia-qemu-d23055b8db88a54b372ebbbffe3681169d2a767a.tar.gz
focaccia-qemu-d23055b8db88a54b372ebbbffe3681169d2a767a.zip
qapi: Require descriptions and tagged sections to be indented
By convention, we indent the second and subsequent lines of
descriptions and tagged sections, except for examples.

Turn this into a hard rule, and apply it to examples, too.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240216145841.2099240-11-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
[Straightforward conflicts in qapi/migration.json resolved]
Diffstat (limited to 'scripts/qapi/parser.py')
-rw-r--r--scripts/qapi/parser.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 3aefec1c2b..f8da315332 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -492,6 +492,9 @@ class QAPIDoc:
                     # indeterminate indentation
                     if self.text != '':
                         # non-blank, non-first line determines indentation
+                        if indent == 0:
+                            raise QAPIParseError(
+                                self._parser, "line needs to be indented")
                         self._indent = indent
                 elif indent < self._indent:
                     raise QAPIParseError(