[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/27] qapi: Improve reporting of missing documentation comment
From: |
Markus Armbruster |
Subject: |
[PULL 25/27] qapi: Improve reporting of missing documentation comment |
Date: |
Sat, 28 Sep 2019 20:39:32 +0200 |
Have check_exprs() check this later, so the error message gains an "in
definition line". Tweak the error message.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
scripts/qapi/common.py | 18 ++++++++----------
tests/qapi-schema/doc-missing.err | 3 ++-
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index fa354b3f1e..bd834270f8 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -933,10 +933,6 @@ def check_exprs(exprs):
if 'include' in expr:
continue
- if not doc and doc_required:
- raise QAPISemError(info,
- "definition missing documentation comment")
-
if 'enum' in expr:
meta = 'enum'
elif 'union' in expr:
@@ -957,9 +953,14 @@ def check_exprs(exprs):
info.set_defn(meta, name)
check_defn_name_str(name, info, meta)
- if doc and doc.symbol != name:
- raise QAPISemError(
- info, "documentation comment is for '%s'" % doc.symbol)
+ if doc:
+ if doc.symbol != name:
+ raise QAPISemError(
+ info, "documentation comment is for '%s'" % doc.symbol)
+ doc.check_expr(expr)
+ elif doc_required:
+ raise QAPISemError(info,
+ "documentation comment required")
if meta == 'enum':
check_keys(expr, info, meta,
@@ -1004,9 +1005,6 @@ def check_exprs(exprs):
check_if(expr, info, meta)
check_flags(expr, info)
- if doc:
- doc.check_expr(expr)
-
return exprs
diff --git a/tests/qapi-schema/doc-missing.err
b/tests/qapi-schema/doc-missing.err
index 08c827931a..7fbf54ff65 100644
--- a/tests/qapi-schema/doc-missing.err
+++ b/tests/qapi-schema/doc-missing.err
@@ -1 +1,2 @@
-tests/qapi-schema/doc-missing.json:5: definition missing documentation comment
+tests/qapi-schema/doc-missing.json: In command 'undocumented':
+tests/qapi-schema/doc-missing.json:5: documentation comment required
--
2.21.0
- [PULL 18/27] qapi: Move context-free checking to the proper place, (continued)
- [PULL 18/27] qapi: Move context-free checking to the proper place, Markus Armbruster, 2019/09/28
- [PULL 24/27] qapi: Eliminate check_keys(), rename check_known_keys(), Markus Armbruster, 2019/09/28
- [PULL 21/27] qapi: Improve reporting of missing / unknown definition keys, Markus Armbruster, 2019/09/28
- [PULL 23/27] qapi: Improve reporting of invalid 'if' further, Markus Armbruster, 2019/09/28
- [PULL 17/27] qapi: Move context-sensitive checking to the proper place, Markus Armbruster, 2019/09/28
- [PULL 03/27] qapi: Rename .owner to .defined_in, Markus Armbruster, 2019/09/28
- [PULL 04/27] qapi: New QAPISourceInfo, replacing dict, Markus Armbruster, 2019/09/28
- [PULL 16/27] qapi: Inline check_name() into check_union(), Markus Armbruster, 2019/09/28
- [PULL 06/27] qapi: Clean up member name case checking, Markus Armbruster, 2019/09/28
- [PULL 12/27] qapi: Report invalid '*' prefix like any other invalid name, Markus Armbruster, 2019/09/28
- [PULL 25/27] qapi: Improve reporting of missing documentation comment,
Markus Armbruster <=
- [PULL 09/27] qapi: Reorder check_FOO() parameters for consistency, Markus Armbruster, 2019/09/28
- [PULL 08/27] qapi: Improve reporting of member name clashes, Markus Armbruster, 2019/09/28
- [PULL 26/27] qapi: Improve reporting of redefinition, Markus Armbruster, 2019/09/28
- [PULL 15/27] qapi: Plumb info to the QAPISchemaMember, Markus Armbruster, 2019/09/28
- [PULL 05/27] qapi: Prefix frontend errors with an "in definition" line, Markus Armbruster, 2019/09/28
- [PULL 22/27] qapi: Avoid redundant definition references in error messages, Markus Armbruster, 2019/09/28
- [PULL 07/27] qapi: Change frontend error messages to start with lower case, Markus Armbruster, 2019/09/28
- Re: [PULL 00/27] QAPI patches for 2019-09-28, Peter Maydell, 2019/09/30