[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 26/42] qapi/parser: add undocumented stub members to all_sections
From: |
John Snow |
Subject: |
[PATCH 26/42] qapi/parser: add undocumented stub members to all_sections |
Date: |
Wed, 5 Feb 2025 18:11:52 -0500 |
This helps simplify the new doc generator if it doesn't have to check
for undocumented members; especially when dealing recursively with
inherited documentation blocks.
NB: If there is no existing 'member' section, these undocumented stub
members will be inserted directly after the intro paragraph(s). This is
potentially problematic for cases where a doc block contains *only* free
paragraphs, but some of those paragraphs are conceptually better suited
for the "outro" section; i.e.:
This patch will insert member documentation after the example,
effectively solidifying all preceding paragraphs as "intro" type, which
may not be what we want.
Solution for this issue is still TBD; auditing is needed to understand
how prevalent the problem is to help engineer a fix or decide it's not
really a problem that needs solving.
While I'm rambling about RFC stuff in the commit message though, this
patch really did help cull over a hundred lines from the new generator,
so I think I'm predisposed to find a way to keep it.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qapi/parser.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index af5d7bf892c..a8b30ae1a4b 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -800,6 +800,18 @@ def connect_member(self, member: 'QAPISchemaMember') ->
None:
section = QAPIDoc.ArgSection(
self.info, QAPIDoc.Kind.MEMBER, member.name)
self.args[member.name] = section
+
+ # Insert stub documentation section for missing member docs.
+ # Determine where to insert stub doc - it should go at the
+ # end of the members section(s), if any. Note that index 0
+ # is assumed to be an untagged intro section, even if it is
+ # empty.
+ index = 1
+ if len(self.all_sections) > 1:
+ while self.all_sections[index].kind == QAPIDoc.Kind.MEMBER:
+ index += 1
+ self.all_sections.insert(index, section)
+
self.args[member.name].connect(member)
def connect_feature(self, feature: 'QAPISchemaFeature') -> None:
--
2.48.1
- [PATCH 16/42] docs/qapidoc: add visit_feature() method, (continued)
- [PATCH 16/42] docs/qapidoc: add visit_feature() method, John Snow, 2025/02/05
- [PATCH 17/42] docs/qapidoc: prepare to record entity being transmogrified, John Snow, 2025/02/05
- [PATCH 18/42] docs/qapidoc: add visit_returns() method, John Snow, 2025/02/05
- [PATCH 19/42] docs/qapidoc: add visit_member() method, John Snow, 2025/02/05
- [PATCH 20/42] docs/qapidoc: add visit_sections() method, John Snow, 2025/02/05
- [PATCH 21/42] docs/qapidoc: add visit_entity(), John Snow, 2025/02/05
- [PATCH 22/42] docs/qapidoc: implement transmogrify() method, John Snow, 2025/02/05
- [PATCH 23/42] docs: disambiguate cross-references, John Snow, 2025/02/05
- [PATCH 24/42] docs/qapidoc: add transmogrifier test document, John Snow, 2025/02/05
- [PATCH 25/42] docs/qapidoc: generate entries for undocumented members, John Snow, 2025/02/05
- [PATCH 26/42] qapi/parser: add undocumented stub members to all_sections,
John Snow <=
- [PATCH 27/42] qapi: differentiate "intro" and "detail" sections, John Snow, 2025/02/05
- [PATCH 28/42] qapi/parser: prohibit untagged sections between tagged sections, John Snow, 2025/02/05
- [PATCH 29/42] qapi: Add "Details:" disambiguation marker, John Snow, 2025/02/05
- [PATCH 30/42] docs/qapidoc: add minimalistic inliner, John Snow, 2025/02/05
- [PATCH 31/42] docs/qapidoc: autogenerate undocumented return docs, John Snow, 2025/02/05
- [PATCH 32/42] docs/qapidoc: Add generated returns documentation to inliner, John Snow, 2025/02/05
- [PATCH 33/42] docs/qmp: add target to Out-of-band execution section, John Snow, 2025/02/05
- [PATCH 35/42] docs/qapidoc: generate out-of-band pseudofeature sections, John Snow, 2025/02/05
- [PATCH 34/42] docs/qapidoc: document the "out-of-band" pseudofeature, John Snow, 2025/02/05
- [PATCH 37/42] qapi/schema: add __iter__ method to QAPISchemaVariants, John Snow, 2025/02/05