qemu/scripts/qapi
John Snow 636c96cd77 qapi: Fix undocumented return values by generating something
Generated command documentation lacks information on return value in
several cases, e.g. query-tpm.

The obvious fix would be to require a Returns: section when a command
returns something.

However, note that many existing Returns: sections are pretty useless:
the description is basically the return type, which then gets rendered
like "Return: <Type> – <basically the return type>".  This suggests
that a description is often not really necessary, and requiring one
isn't useful.

Instead, generate the obvious minimal thing when Returns: is absent:
"Return: <Type>".

This auto-generated Return documentation is placed is as follows:

1. If we have arguments, return goes right after them.
2. Else if we have errors, return goes right before them.
3. Else if we have features, return goes right before them.
4. Else return goes right after the intro

To facilitate this algorithm, a "TODO:" hack line is used to separate
the intro from the remainder of the documentation block in cases where
there are no other sections to separate the intro from e.g. examples and
additional detail meant to appear below the key sections of interest.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20250711051045.51110-3-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[_insert_near_kind() code replaced by something simpler, commit
message amended to explain why we're doing this]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2025-07-14 12:03:03 +02:00
..
__init__.py qapi-gen: New common driver for code and doc generators 2018-03-02 13:14:09 -06:00
backend.py qapi: Add some pylint ignores 2025-06-05 12:08:53 -04:00
commands.py qapi: expose all schema features to code 2025-02-10 15:45:04 +01:00
common.py qapi: Smarter camel_to_upper() to reduce need for 'prefix' 2024-09-10 13:22:47 +02:00
error.py qapi/error: Add type hints 2021-04-30 12:59:54 +02:00
events.py qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
expr.py qapi: Fix to reject 'data': 'mumble' in struct 2023-04-24 15:21:39 +02:00
features.py qapi: expose all schema features to code 2025-02-10 15:45:04 +01:00
gen.py qapi: expose all schema features to code 2025-02-10 15:45:04 +01:00
introspect.py qapi/introspect: Use @dataclass to simplify 2025-03-06 10:09:25 +01:00
main.py scripts/qapi/backend: Clean up create_backend()'s failure mode 2025-03-11 10:26:52 +01:00
parser.py qapi: Fix undocumented return values by generating something 2025-07-14 12:03:03 +02:00
pylintrc python: add qapi static analysis tests 2025-06-05 12:09:43 -04:00
schema.py qapi: Fix undocumented return values by generating something 2025-07-14 12:03:03 +02:00
source.py qapi/source: allow multi-line QAPISourceInfo advancing 2025-03-11 10:10:57 +01:00
types.py qapi: expose all schema features to code 2025-02-10 15:45:04 +01:00
visit.py qapi: expose all schema features to code 2025-02-10 15:45:04 +01:00