From 63f93a176b066947ef072060e649f39f7b7174ba Mon Sep 17 00:00:00 2001 From: Maarten van der Schrieck Date: Sat, 23 Dec 2023 03:14:24 +0100 Subject: [PATCH] addons/cppcheckdata.py: Make reportError() return the line written. This is useful for self-verification, as is done by namingng.py. The return value of reportError() is otherwise not used. --- addons/cppcheckdata.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/cppcheckdata.py b/addons/cppcheckdata.py index ee669b0e4209..1bd835051c83 100755 --- a/addons/cppcheckdata.py +++ b/addons/cppcheckdata.py @@ -1629,16 +1629,19 @@ def reportError(location, severity, message, addon, errorId, extra=''): 'addon': addon, 'errorId': errorId, 'extra': extra} - sys.stdout.write(json.dumps(msg) + '\n') + line = json.dumps(msg) + '\n' + sys.stdout.write(line) else: if is_suppressed(location, message, '%s-%s' % (addon, errorId)): return loc = '[%s:%i]' % (location.file, location.linenr) if len(extra) > 0: message += ' (' + extra + ')' - sys.stderr.write('%s (%s) %s [%s-%s]\n' % (loc, severity, message, addon, errorId)) + line = '%s (%s) %s [%s-%s]\n' % (loc, severity, message, addon, errorId) + sys.stderr.write(line) global EXIT_CODE EXIT_CODE = 1 + return line def reportSummary(dumpfile, summary_type, summary_data): # dumpfile ends with ".dump"