triage_version.py: extend template for 1.x versions with error ID (#4801)

This commit is contained in:
Oliver Stöneberg 2023-02-24 07:02:51 +01:00 committed by GitHub
parent 1bfa20ecf9
commit 535ab69fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 14 deletions

View File

@ -104,30 +104,40 @@ for entry in versions:
# sanitize version # sanitize version
version = version.replace('Cppcheck ', '').replace(' dev', '') version = version.replace('Cppcheck ', '').replace(' dev', '')
cmd = exe cmd = [exe]
cmd += ' '
if do_compare and not args.no_quiet: if do_compare and not args.no_quiet:
cmd += ' -q ' cmd.append('-q')
if args.debug and Version(version) >= Version('1.45'): if args.debug and Version(version) >= Version('1.45'):
cmd += '--debug ' cmd.append('--debug')
if args.debug_warnings and Version(version) >= Version('1.45'): if args.debug_warnings and Version(version) >= Version('1.45'):
cmd += '--debug-warnings ' cmd.append('--debug-warnings')
if args.check_library and Version(version) >= Version('1.61'): if args.check_library and Version(version) >= Version('1.61'):
cmd += '--check-library ' cmd.append('--check-library')
if Version(version) >= Version('1.39'): if Version(version) >= Version('1.39'):
cmd += '--enable=all ' cmd.append('--enable=all')
if Version(version) >= Version('1.40'): if Version(version) >= Version('1.40'):
cmd += '--inline-suppr ' cmd.append('--inline-suppr')
if Version(version) >= Version('1.48'): if Version(version) >= Version('1.48'):
cmd += '--suppress=missingInclude --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=unusedFunction ' cmd.append('--suppress=missingInclude')
cmd.append('--suppress=missingIncludeSystem')
cmd.append('--suppress=unmatchedSuppression')
cmd.append('--suppress=unusedFunction')
if Version(version) >= Version('1.49'): if Version(version) >= Version('1.49'):
cmd += '--inconclusive ' cmd.append('--inconclusive')
if Version(version) >= Version('1.69'): if Version(version) >= Version('1.69'):
cmd += '--platform=native ' cmd.append('--platform=native')
cmd += input_file if Version(version) >= Version('1.52') and Version(version) < Version('2.0'):
# extend Cppcheck 1.x format with error ID
if Version(version) < Version('1.61'):
# TODO: re-add inconclusive
cmd.append('--template=[{file}:{line}]: ({severity}) {message} [{id}]')
else:
# TODO: re-add inconclusive: {callstack}: ({severity}{inconclusive:, inconclusive}) {message
cmd.append('--template={callstack}: ({severity}) {message} [{id}]')
cmd.append(input_file)
if verbose: if verbose:
print("running '{}'". format(cmd)) print("running '{}'". format(' '.join(cmd)))
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=exe_path, universal_newlines=True) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=exe_path, universal_newlines=True)
try: try:
comm = p.communicate(timeout=args.timeout) comm = p.communicate(timeout=args.timeout)
out = '' out = ''