]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Warn about statements in grammar not described in docs
authorPetr Špaček <pspacek@isc.org>
Thu, 12 May 2022 17:16:52 +0000 (19:16 +0200)
committerPetr Špaček <pspacek@isc.org>
Fri, 1 Jul 2022 06:59:22 +0000 (08:59 +0200)
Skip over obsolete options.

doc/arm/_ext/iscconf.py

index cc03766475cbe83a9edf37509b8c9d8bdca036f1..a6ecf212fdd1eb0e434d678d4a4ae2627b6ff81e 100644 (file)
@@ -268,6 +268,29 @@ def domain_factory(domainname, domainlabel, todolist, grammar):
                 self.log_statement_overlap(new[name], old[name])
             old.update(new)
 
+        def check_consistency(self):
+            """Sphinx API"""
+            defined_statements = set(
+                obj["signature"] for obj in self.data["statements"].values()
+            )
+            statements_in_grammar = set(self.statement_blocks)
+            missing_statement_sigs = statements_in_grammar.difference(
+                defined_statements
+            )
+            for missing in missing_statement_sigs:
+                grammars = self.statement_grammar_groups[missing]
+                if len(grammars) == 1:
+                    flags = grammars[0][0].subgrammar.get("_flags", [])
+                    if ("obsolete" in flags) or ("test only" in flags):
+                        continue
+
+                logger.warning(
+                    "statement %s is defined in %s grammar but is not described"
+                    " using .. statement:: directive",
+                    missing,
+                    domainlabel,
+                )
+
         @classmethod
         def process_statementlist_nodes(cls, app, doctree, fromdocname):
             """