aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-02-05 08:47:00 +0100
committerMarkus Armbruster <armbru@redhat.com>2024-02-12 10:04:31 +0100
commit0cec50119f803723f608f6498975799ab35abf52 (patch)
treeb115456fe01e28a8614b068160043332f36a21bf /scripts
parentfd62bff901b6c25df4971066b74049548caadc83 (diff)
qapi: Require member documentation (with loophole)
The QAPI generator forces you to document your stuff. Except for command arguments, event data, and members of enum and object types: these the generator silently "documents" as "Not documented". We can't require proper documentation there without first fixing all the offenders. We've always had too many offenders to pull that off. Right now, we have more than 500. Worse, we seem to fix old ones no faster than we add new ones: in the past year, we fixed 22 ones, but added 26 new ones. To help arrest the backsliding, make missing documentation an error unless the command, type, or event is in listed in new pragma documentation-exceptions. List all the current offenders: 117 commands and types in qapi/, and 9 in qga/. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-ID: <20240205074709.3613229-7-armbru@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/parser.py7
-rw-r--r--scripts/qapi/source.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 48cd55a38c..88221b3c64 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -238,6 +238,8 @@ class QAPISchemaParser:
pragma.command_name_exceptions = check_list_str(name, value)
elif name == 'command-returns-exceptions':
pragma.command_returns_exceptions = check_list_str(name, value)
+ elif name == 'documentation-exceptions':
+ pragma.documentation_exceptions = check_list_str(name, value)
elif name == 'member-name-exceptions':
pragma.member_name_exceptions = check_list_str(name, value)
else:
@@ -739,7 +741,10 @@ class QAPIDoc:
def connect_member(self, member: 'QAPISchemaMember') -> None:
if member.name not in self.args:
- # Undocumented TODO outlaw
+ if self.symbol not in member.info.pragma.documentation_exceptions:
+ raise QAPISemError(member.info,
+ "%s '%s' lacks documentation"
+ % (member.role, member.name))
self.args[member.name] = QAPIDoc.ArgSection(self._parser,
member.name)
self.args[member.name].connect(member)
diff --git a/scripts/qapi/source.py b/scripts/qapi/source.py
index 04193cc964..7b379fdc92 100644
--- a/scripts/qapi/source.py
+++ b/scripts/qapi/source.py
@@ -24,6 +24,8 @@ class QAPISchemaPragma:
self.command_name_exceptions: List[str] = []
# Commands allowed to return a non-dictionary
self.command_returns_exceptions: List[str] = []
+ # Types, commands, and events with undocumented members
+ self.documentation_exceptions: List[str] = []
# Types whose member names may violate case conventions
self.member_name_exceptions: List[str] = []