@@ -205,37 +205,22 @@ async function runCppcheckOnFileXML(
205205 } ) ;
206206
207207 let proc ;
208+ const args = [
209+ '--enable=all' ,
210+ '--inline-suppr' ,
211+ '--xml' ,
212+ '--suppress=unusedFunction' ,
213+ '--suppress=missingInclude' ,
214+ '--suppress=missingIncludeSystem' ,
215+ ...argsParsed ,
216+ ] . filter ( Boolean ) ;
208217 if ( processedArgs . includes ( "--project" ) ) {
209- const args = [
210- '--enable=all' ,
211- '--inline-suppr' ,
212- '--xml' ,
213- '--suppress=unusedFunction' ,
214- '--suppress=missingInclude' ,
215- '--suppress=missingIncludeSystem' ,
216- `--file-filter=${ filePath } ` ,
217- ...argsParsed ,
218- ] . filter ( Boolean ) ;
219- proc = cp . spawn ( commandPath , args , {
220- cwd : path . dirname ( document . fileName ) ,
221- } ) ;
222- } else {
223- const args = [
224- '--enable=all' ,
225- '--inline-suppr' ,
226- '--xml' ,
227- '--suppress=unusedFunction' ,
228- '--suppress=missingInclude' ,
229- '--suppress=missingIncludeSystem' ,
230- ...argsParsed ,
231- filePath ,
232- ] . filter ( Boolean ) ;
233-
234- const cwd = findWorkspaceRoot ( ) ;
235- proc = cp . spawn ( commandPath , args , {
236- cwd,
237- } ) ;
218+ args . push ( `--file-filter=${ filePath } ` ) ;
238219 }
220+ const cwd = findWorkspaceRoot ( ) ;
221+ proc = cp . spawn ( commandPath , args , {
222+ cwd,
223+ } ) ;
239224
240225 // if spawn fails (e.g. ENOENT or permission denied)
241226 proc . on ( "error" , ( err ) => {
0 commit comments