diff --git a/addons/namingng.py b/addons/namingng.py index a543669d5..6ce9aa2b3 100755 --- a/addons/namingng.py +++ b/addons/namingng.py @@ -24,6 +24,7 @@ import cppcheckdata import sys +import os import re import argparse import json @@ -96,10 +97,14 @@ def process(dumpfiles, configfile, debugprint=False): # Check File naming if "RE_FILE" in conf and conf["RE_FILE"]: - mockToken = DataStruct(afile[:-5], "0", afile[afile.rfind('/') + 1:-5]) - msgType = 'File name' - for exp in conf["RE_FILE"]: - evalExpr(conf["RE_FILE"], exp, mockToken, msgType, errors) + for source_file in data.files: + basename = os.path.basename(source_file) + good = False + for exp in conf["RE_FILE"]: + good |= bool(re.match(exp, source_file)) + good |= bool(re.match(exp, basename)) + if not good: + errors.append(reportError(source_file, 0, 'style', 'File name ' + source_file + ' violates naming convention')) # Check Namespace naming if "RE_NAMESPACE" in conf and conf["RE_NAMESPACE"]: