[PATCH v2 1/3] tools/check-glossaries: return 1 in case of failure
Antonin Godard <[email protected]> Fri, 03 Jul 2026 13:31:24 +0200
| Newsgroups | org.yoctoproject.lists.docs |
|---|---|
| Message-ID | <[email protected]> |
Exit with 1 in case there's an issue with the glossaries. This will be used for pre-commit support. Reviewed-by: Quentin Schulz <[email protected]> Signed-off-by: Antonin Godard <[email protected]> --- documentation/tools/check-glossaries | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/documentation/tools/check-glossaries b/documentation/tools/check-glossaries index b5dfe834e..9f1a47126 100755 --- a/documentation/tools/check-glossaries +++ b/documentation/tools/check-glossaries @@ -4,6 +4,7 @@ import argparse import difflib import os import re +import sys from pathlib import Path @@ -33,6 +34,7 @@ def main(): # :term:`A <ABIEXTENSION>` :term:`B` :term:`C <CACHE>` glossary_re = re.compile(r":term:`(?P<letter>[A-Z]{1})( <(?P<varname>[A-Z_]+)>)?`") entry_re = re.compile(r"^ :term:`(?P<entry>.+)`\s*$") + exit_code = 0 for rst in glossaries: @@ -74,6 +76,7 @@ def main(): if diffs: print(f"WARNING: {rst}: entries are not properly sorted:") print('\n'.join(diffs)) + exit_code = 1 for letter in glossary: try: @@ -81,9 +84,13 @@ def main(): except ValueError: print(f"WARNING: {rst}: variable " f"{glossary[letter]} in glossary does not exist") + exit_code = 1 if index > 0 and entries[index - 1].startswith(letter[0]): print(f"WARNING: {rst}: The variable {glossary[letter]} shouldn't be in " "the glossary.") + exit_code = 1 + + sys.exit(exit_code) if __name__ == "__main__": -- 2.54.0