summaryrefslogtreecommitdiffstats
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster2021-03-23 10:40:11 +0100
committerMarkus Armbruster2021-03-23 22:31:05 +0100
commit3e6c8a633113fb6a60369c40cf2061de50727bf6 (patch)
treeb04ba3ff47afa8f1559a3774add4dd299a5232bf /scripts/qapi
parentqapi: Enforce event naming rules (diff)
downloadqemu-3e6c8a633113fb6a60369c40cf2061de50727bf6.tar.gz
qemu-3e6c8a633113fb6a60369c40cf2061de50727bf6.tar.xz
qemu-3e6c8a633113fb6a60369c40cf2061de50727bf6.zip
qapi: Enforce type naming rules
Type names should be CamelCase. Enforce this. The only offenders are in tests/. Fix them. Add test type-case to cover the new error. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210323094025.3569441-15-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Regexp simplified, new test made more robust]
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/expr.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index c065505b27..7bd15559de 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -61,7 +61,8 @@ def check_name_lower(name, info, source,
def check_name_camel(name, info, source):
stem = check_name_str(name, info, source)
- # TODO reject '[_-]' in stem, require CamelCase
+ if not re.match(r'[A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*$', stem):
+ raise QAPISemError(info, "name of %s must use CamelCase" % source)
def check_defn_name_str(name, info, meta):