MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / validateConfigREs

Function validateConfigREs

addons/namingng.py:57–75  ·  view source on GitHub ↗
(list_or_dict,json_key)

Source from the content-addressed store, hash-verified

55 sys.exit(1)
56
57def validateConfigREs(list_or_dict,json_key):
58 have_error = False
59 for item in list_or_dict:
60 try:
61 re.compile(item)
62 except re.error as err:
63 configError("item '%s' of '%s' is not a valid regular expression: %s"%(item,json_key,err),fatal=False)
64 have_error = True
65 continue
66 if not isinstance(list_or_dict,dict):
67 continue
68 # item is actually a dict key; check value
69 value = list_or_dict[item]
70 if (not isinstance(value,list) or len(value) != 2
71 or not isinstance(value[0],bool) or not isinstance(value[1],str)):
72 configError("item '%s' of '%s' must be an array [bool,string]"%(item,json_key),fatal=False)
73 have_error = True
74
75 return have_error
76
77def loadConfig(configfile):
78 if not os.path.exists(configfile):

Callers 1

loadConfigFunction · 0.85

Calls 2

configErrorFunction · 0.85
compileMethod · 0.80

Tested by

no test coverage detected