1
0
Fork 0
frr/tools/coccinelle/json_object_add_camel_case.cocci

20 lines
439 B
Text
Raw Normal View History

// Catch whitespaces in JSON keys
@r@
identifier json;
constant key;
identifier func =~ "json_object_";
position p;
@@
func(json, key, ...)@p
@script:python@
fmt << r.key;
p << r.p;
@@
if " " in str(fmt):
print("Whitespace detected in JSON keys %s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt))
if str(fmt)[1].isupper():
print("Capital first detected in JSON keys %s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt))