From 06f19fb3a724a90acf32cdf202d44dc5c32fb33d Mon Sep 17 00:00:00 2001 From: Konrad Grochowski Date: Wed, 6 Jun 2018 14:53:09 +0200 Subject: [PATCH] misra.py: template used for error reporting will now be configurable (#1279) WARNING: breaking change - now default misra.py report style will be the same as cppcheck itself, but previosly misra.py default template was a little different --- addons/misra.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/misra.py b/addons/misra.py index b106c0aa8..606c8f3ed 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -61,13 +61,15 @@ def reportError(location, num1, num2): errmsg = 'misra violation (use --rule-texts= to get proper output) [' + id + ']' else: return - if not cppcheckdata.reportError('[{file}:{line}] ({severity}): {message}', - callstack=[(location.file, location.linenr)], - severity='style', - message = errmsg + '\n', - errorId = id, - suppressions = suppressions, - outputFunc = sys.stderr.write) is None: + formattedMsg = cppcheckdata.reportError(args.template, + callstack=[(location.file, location.linenr)], + severity='style', + message = errmsg, + errorId = id, + suppressions = suppressions) + if formattedMsg: + sys.stderr.write(formattedMsg) + sys.stderr.write('\n') VIOLATIONS.append(errmsg) @@ -1868,7 +1870,7 @@ and 20.13, run: ''' -parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) +parser = cppcheckdata.ArgumentParser() parser.add_argument("--rule-texts", type=str, help=RULE_TEXTS_HELP) parser.add_argument("--suppress-rules", type=str, help=SUPPRESS_RULES_HELP) parser.add_argument("--quiet", help="Only print something when there is an error", action="store_true")