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:
parent
cc0f3f6cec
commit
06f19fb3a7
|
@ -61,13 +61,15 @@ def reportError(location, num1, num2):
|
||||||
errmsg = 'misra violation (use --rule-texts=<file> to get proper output) [' + id + ']'
|
errmsg = 'misra violation (use --rule-texts=<file> to get proper output) [' + id + ']'
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if not cppcheckdata.reportError('[{file}:{line}] ({severity}): {message}',
|
formattedMsg = cppcheckdata.reportError(args.template,
|
||||||
callstack=[(location.file, location.linenr)],
|
callstack=[(location.file, location.linenr)],
|
||||||
severity='style',
|
severity='style',
|
||||||
message = errmsg + '\n',
|
message = errmsg,
|
||||||
errorId = id,
|
errorId = id,
|
||||||
suppressions = suppressions,
|
suppressions = suppressions)
|
||||||
outputFunc = sys.stderr.write) is None:
|
if formattedMsg:
|
||||||
|
sys.stderr.write(formattedMsg)
|
||||||
|
sys.stderr.write('\n')
|
||||||
VIOLATIONS.append(errmsg)
|
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("--rule-texts", type=str, help=RULE_TEXTS_HELP)
|
||||||
parser.add_argument("--suppress-rules", type=str, help=SUPPRESS_RULES_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")
|
parser.add_argument("--quiet", help="Only print something when there is an error", action="store_true")
|
||||||
|
|
Loading…
Reference in New Issue