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
This commit is contained in:
Konrad Grochowski 2018-06-06 14:53:09 +02:00 committed by Daniel Marjamäki
parent cc0f3f6cec
commit 06f19fb3a7
1 changed files with 10 additions and 8 deletions

View File

@ -61,13 +61,15 @@ def reportError(location, num1, num2):
errmsg = 'misra violation (use --rule-texts=<file> to get proper output) [' + id + ']'
else:
return
if not cppcheckdata.reportError('[{file}:{line}] ({severity}): {message}',
formattedMsg = cppcheckdata.reportError(args.template,
callstack=[(location.file, location.linenr)],
severity='style',
message = errmsg + '\n',
message = errmsg,
errorId = id,
suppressions = suppressions,
outputFunc = sys.stderr.write) is None:
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")