Docs: Add warning for bad usage strings

This commit is contained in:
Ole Schütt 2025-02-14 11:21:17 +01:00 committed by Ole Schütt
parent fb643211e1
commit 6e8e403088
2 changed files with 19 additions and 0 deletions

View file

@ -311,6 +311,11 @@ def render_keyword(
location = get_text(keyword.find("LOCATION"))
lone_keyword_value = get_text(keyword.find("LONE_KEYWORD_VALUE"))
# Check that the usage string starts with one of the keyword names.
if keyword.tag == "KEYWORD" and usage:
if not any(usage.upper().startswith(n) for n in keyword_names):
print(f"Warning: Keyword {keyword_xref} has bad usage: {location}")
# Find keyword data type.
data_type_element = keyword.find("DATA_TYPE")
assert data_type_element is not None