Menu

--file-filter

Mike Cash
2021-08-06
2021-08-11
  • Mike Cash

    Mike Cash - 2021-08-06

    Can the <str> value for --file-filter include multiple file types? For example: ".c;.cpp". I am working on a precommit script and would like to filter the files that cppcheck will scan. The script gets as an argument all the files that are to be committed and may include files that cppcheck should not scan (.h, .txt, etc)</str>

     
  • Daniel Marjamäki

    not currently. but *.c* might be acceptable?

    but hmm .. as far as I remember the --file-filter is only used when you have a project file. that would not normally build txt/h/etc files. how do you pass the files to check to cppcheck?

     
  • Mike Cash

    Mike Cash - 2021-08-11

    Thanks for that suggestion. That will work for us for the time being though in the long term if there are files with differing extensions that we would like to check we might need to think about it a little more. Seems like allowing multiple extensions in the <str> argument would be a nice update.</str>

    We are using TortoiseGit and it provides a file with a list of files that are to be committed as an input argument to the script. We are not using a project file. Command line used in the .bat file is:

    cppcheck.exe --error-exitcode=1 --file-list=%1 --file-filter=.c %OPT% > cpp.log 2>&1

    %OPT% is the list of suppressions to use during evaluation.

     
  • Mike Cash

    Mike Cash - 2021-08-11

    Thanks for that suggestion. That will work for us for the time being though in the long term if there are files with differing extensions that we would like to check we might need to think about it a little more. Seems like allowing multiple extensions in the <str> argument would be a nice update.</str>

    We are using TortoiseGit and it provides a file with a list of files that are to be committed as an input argument to the script. We are not using a project file. Command line used in the .bat file is:

    cppcheck.exe --error-exitcode=1 --file-list=%1 --file-filter=.c %OPT% > cpp.log 2>&1

    %OPT% is the list of suppressions to use during evaluation.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.