Skip to content

Commit

Permalink
addons/namingng.py: Take filename from data.files.
Browse files Browse the repository at this point in the history
namingng.py attempts to derive the source filename from the name of the
dumpfile. However, the dumpfile is not necessarily named according to this
pattern, e.g. cppcheck will add the pid to the filename, making RE_FILE rules
fail. Taking the first item of data.files seem to be more robust.

To get the basename of the file, os.path.basename() is used. This solves
(theoretical) issues on platforms with a different path separator.
  • Loading branch information
mvds00 committed Dec 23, 2023
1 parent 5a222b8 commit 1d71750
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/namingng.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ 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])
source_file = data.files[0]
mockToken = DataStruct(source_file, "0", os.path.basename(source_file))
msgType = 'File name'
for exp in conf["RE_FILE"]:
evalExpr(conf["RE_FILE"], exp, mockToken, msgType, errors)
Expand Down

0 comments on commit 1d71750

Please sign in to comment.