From 15333abed9112f99e0b1af4327154af733b987d3 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 16 Feb 2024 15:58:29 +0100 Subject: qapi: Improve error position for bogus argument descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When documented arguments don't exist, the error message points to the beginning of the definition comment. Point to the first bogus argument description instead. Signed-off-by: Markus Armbruster Message-ID: <20240216145841.2099240-6-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé --- scripts/qapi/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/qapi') diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 88221b3c64..82db595dcf 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -472,6 +472,8 @@ class QAPIDoc: # pylint: disable=too-few-public-methods def __init__(self, parser: QAPISchemaParser, name: Optional[str] = None): + # section source info, i.e. where it begins + self.info = parser.info # parser, for error messages about indentation self._parser = parser # optional section name (argument/member or section name) @@ -770,7 +772,7 @@ class QAPIDoc: if not section.member] if bogus: raise QAPISemError( - self.info, + args[bogus[0]].info, "documented %s%s '%s' %s not exist" % ( what, "s" if len(bogus) > 1 else "", -- cgit v1.2.3