From d4f4cae8de19d2bdfcf09cdc4676e9b99857dcf2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 23 Mar 2021 10:40:10 +0100 Subject: qapi: Enforce event naming rules Event names should be ALL_CAPS with words separated by underscore. Enforce this. The only offenders are in tests/. Fix them. Existing test event-case covers the new error. Signed-off-by: Markus Armbruster Message-Id: <20210323094025.3569441-14-armbru@redhat.com> Reviewed-by: Eric Blake --- scripts/qapi/expr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts/qapi/expr.py') diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index b5fb0be48b..c065505b27 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -45,7 +45,9 @@ def check_name_str(name, info, source): def check_name_upper(name, info, source): stem = check_name_str(name, info, source) - # TODO reject '[a-z-]' in @stem + if re.search(r'[a-z-]', stem): + raise QAPISemError( + info, "name of %s must not use lowercase or '-'" % source) def check_name_lower(name, info, source, -- cgit 1.4.1