0

Is there a way to pass custom file extensions to Cppcheck? For example, *.pc.

Jongware
  • 22,200
  • 8
  • 54
  • 100
James
  • 65
  • 1
  • 5

1 Answers1

4

sure. cppcheck will check any file that you give it.

check the file xyz.pc:

cppcheck xyz.pc

check all files with extension pc in folder srcfolder (this at least works in linux):

cppcheck srcfolder/*.pc

the --file-list flag may also be useful. you could generate the list of files that you want to check using an arbitrary script. and then run cppcheck on that file list.

cppcheck --file-list=files.txt
Daniel Marjamäki
  • 2,907
  • 15
  • 16
  • Thanks! Ended up writing a script to gather all the file types into a list, and pass that in. – James Aug 12 '14 at 10:33
  • @Daniel Marjamäki Would it be possible to add a command line option to specify extensions to look at ? For instance, I use .cxx, .hxx and .inl for my C++ projects. I would rather not have to specify those files or create an alias for cppcheck that is cppcheck --file-list=. – ghlecl Apr 14 '18 at 16:49
  • 1
    not sure.. I am not _against_ it. It's just that we are pretty careful about adding command line arguments and this is not a common feature request. The .cxx is handled already. I would recommend that you dont add headers (.hxx) it is better for the analysis if you include those and check the source files. I do not know what .inl is, is that included files also? – Daniel Marjamäki Apr 15 '18 at 20:43
  • is there any way to add this functionality to a powershell script so that it auto runs rather than typing it in a terminal? – NeonFire May 21 '21 at 19:49