2
0
Эх сурвалжийг харах

qapi: Polish reporting of bogus member documentation

Improve error messages from

    the following documented members are not in the declaration: a
    the following documented members are not in the declaration: aa, bb

to the more concise

    documented member 'a' does not exist
    documented members 'aa', 'bb' do not exist

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191024110237.30963-19-armbru@redhat.com>
Markus Armbruster 5 жил өмнө
parent
commit
e4def78755

+ 4 - 2
scripts/qapi/parser.py

@@ -566,5 +566,7 @@ def check(self):
         if bogus:
             raise QAPISemError(
                 self.info,
-                "the following documented members are not in "
-                "the declaration: %s" % ", ".join(bogus))
+                "documented member%s '%s' %s not exist"
+                % ("s" if len(bogus) > 1 else "",
+                   "', '".join(bogus),
+                   "do" if len(bogus) > 1 else "does"))

+ 1 - 1
tests/qapi-schema/doc-bad-alternate-member.err

@@ -1 +1 @@
-doc-bad-alternate-member.json:3: the following documented members are not in the declaration: aa, bb
+doc-bad-alternate-member.json:3: documented members 'aa', 'bb' do not exist

+ 1 - 1
tests/qapi-schema/doc-bad-boxed-command-arg.err

@@ -1 +1 @@
-doc-bad-boxed-command-arg.json:9: the following documented members are not in the declaration: a
+doc-bad-boxed-command-arg.json:9: documented member 'a' does not exist

+ 1 - 1
tests/qapi-schema/doc-bad-command-arg.err

@@ -1 +1 @@
-doc-bad-command-arg.json:3: the following documented members are not in the declaration: b
+doc-bad-command-arg.json:3: documented member 'b' does not exist

+ 1 - 1
tests/qapi-schema/doc-bad-enum-member.err

@@ -1 +1 @@
-doc-bad-enum-member.json:3: the following documented members are not in the declaration: a
+doc-bad-enum-member.json:3: documented member 'a' does not exist

+ 1 - 1
tests/qapi-schema/doc-bad-event-arg.err

@@ -1 +1 @@
-doc-bad-event-arg.json:3: the following documented members are not in the declaration: a
+doc-bad-event-arg.json:3: documented member 'a' does not exist

+ 1 - 1
tests/qapi-schema/doc-bad-union-member.err

@@ -1 +1 @@
-doc-bad-union-member.json:3: the following documented members are not in the declaration: a, b
+doc-bad-union-member.json:3: documented members 'a', 'b' do not exist