@@ -104,30 +104,40 @@ def sort_commit_hashes(commits):
104104 # sanitize version
105105 version = version .replace ('Cppcheck ' , '' ).replace (' dev' , '' )
106106
107- cmd = exe
108- cmd += ' '
107+ cmd = [exe ]
109108 if do_compare and not args .no_quiet :
110- cmd += ' -q '
109+ cmd . append ( '-q' )
111110 if args .debug and Version (version ) >= Version ('1.45' ):
112- cmd += '--debug '
111+ cmd . append ( '--debug' )
113112 if args .debug_warnings and Version (version ) >= Version ('1.45' ):
114- cmd += '--debug-warnings '
113+ cmd . append ( '--debug-warnings' )
115114 if args .check_library and Version (version ) >= Version ('1.61' ):
116- cmd += '--check-library '
115+ cmd . append ( '--check-library' )
117116 if Version (version ) >= Version ('1.39' ):
118- cmd += '--enable=all '
117+ cmd . append ( '--enable=all' )
119118 if Version (version ) >= Version ('1.40' ):
120- cmd += '--inline-suppr '
119+ cmd . append ( '--inline-suppr' )
121120 if Version (version ) >= Version ('1.48' ):
122- cmd += '--suppress=missingInclude --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=unusedFunction '
121+ cmd .append ('--suppress=missingInclude' )
122+ cmd .append ('--suppress=missingIncludeSystem' )
123+ cmd .append ('--suppress=unmatchedSuppression' )
124+ cmd .append ('--suppress=unusedFunction' )
123125 if Version (version ) >= Version ('1.49' ):
124- cmd += '--inconclusive '
126+ cmd . append ( '--inconclusive' )
125127 if Version (version ) >= Version ('1.69' ):
126- cmd += '--platform=native '
127- cmd += input_file
128+ cmd .append ('--platform=native' )
129+ if Version (version ) >= Version ('1.52' ) and Version (version ) < Version ('2.0' ):
130+ # extend Cppcheck 1.x format with error ID
131+ if Version (version ) < Version ('1.61' ):
132+ # TODO: re-add inconclusive
133+ cmd .append ('--template=[{file}:{line}]: ({severity}) {message} [{id}]' )
134+ else :
135+ # TODO: re-add inconclusive: {callstack}: ({severity}{inconclusive:, inconclusive}) {message
136+ cmd .append ('--template={callstack}: ({severity}) {message} [{id}]' )
137+ cmd .append (input_file )
128138 if verbose :
129- print ("running '{}'" . format (cmd ))
130- p = subprocess .Popen (cmd . split () , stdout = subprocess .PIPE , stderr = subprocess .PIPE , cwd = exe_path , universal_newlines = True )
139+ print ("running '{}'" . format (' ' . join ( cmd ) ))
140+ p = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , cwd = exe_path , universal_newlines = True )
131141 try :
132142 comm = p .communicate (timeout = args .timeout )
133143 out = ''
0 commit comments