Skip to content

Commit a8f6415

Browse files
committed
addons/namingng.py: Fixes to RE_FILE check.
The second argument of DataStruct is linenr, which needs to be an integer to prevent an exception in the JSON parsing of cppcheck. The path checked for RE_FILE should be the actual filename instead of a filename (incorrectly) derived from the dump file.
1 parent fcb7cb5 commit a8f6415

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎addons/namingng.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import cppcheckdata
2626
import sys
27+
import os
2728
import re
2829
import argparse
2930
import json
@@ -88,7 +89,8 @@ def process(dumpfiles, configfile, debugprint=False):
8889

8990
# Check File naming
9091
if "RE_FILE" in conf and conf["RE_FILE"]:
91-
mockToken = DataStruct(afile[:-5], "0", afile[afile.rfind('/') + 1:-5])
92+
basename = os.path.basename(data.files[0])
93+
mockToken = DataStruct(data.files[0], 0, basename)
9294
msgType = 'File name'
9395
for exp in conf["RE_FILE"]:
9496
evalExpr(conf["RE_FILE"], exp, mockToken, msgType)

0 commit comments

Comments
 (0)