OneMoreGres / qtc-cppcheck

Qt Creator Cppcheck integration plugin [deprecated]
MIT License
126 stars 37 forks source link

Excluding files does not work #33

Closed gilprime closed 7 years ago

gilprime commented 7 years ago

As the custom parameters now works properly, see issue #30 , I've tried now to exclude lib files from my project, all the external library files are located in the libs directory.

So i've tried the --config-exclude=libs/ this does not work properly. After viewing the issue #17 i've tested the --suppress option without success.

If i use the --suppress on some files here is the command line executed : Starting CppChecker with:C:/Program Files/Cppcheck/cppcheck.exe, --std=c++11 --language=c++ -j9 --suppress=*:quazip.cpp --suppress=*:quazip.h --suppress=*:qioapi.cpp --suppress=*:quazip_unzip.cpp --config-exclude=libs/ --enable=warning,style,performance,portability,information,missingInclude,unusedFunction --template={file},{line},{severity},{id},{message} --file-list=C:/Users/Myself/AppData/Local/Temp/qtcreator.V15064 --includes-file=C:/Users/Myself/AppData/Local/Temp/qtcreator.n15064

In the previous command line, my custom parameters are the following : --std=c++11 --language=c++ -j9 --suppress=*:quazip.cpp --suppress=*:quazip.h --suppress=*:qioapi.cpp --suppress=*:quazip_unzip.cpp --config-exclude=libs/

It already checks for the unwanted files.

I've also tried to surround the --suppress parameter with quotation marks, and this leads to the following execution warning : Failed to add suppression. Invalid id ""*"

Currenly using Windows 7 x64 - QtCreator 4.3.1 - Qtccppcheck 4.3.1

OneMoreGres commented 7 years ago
  1. Afaik --config-exclude does not exclude files from check (just doesn't count its ifdefs), so maybe you have wrong expectations about it.
  2. It and --suppress might not work because of relative paths. Either you should use absolute paths (by hand or via variables) or wildcards (not sure about --config-exclude, but --suppress definitely supports it).
  3. There is separate options field for excluding files from check (with wildcards supported) right below custom parameters. Maybe it is what you are looking for.

So, in short, how i see it:

gilprime commented 7 years ago

I haven't see the plugin's field, nice to know.

Anyway, i've tried to add the files in the plugins field, they are already checked... Plus the --suppress does not remove the errors from the output problems...

I have quickly see the code, and it generates a temporary file with all the files to check, why the files in the plugin ignore pattern that are matching are not removed from that file ?

Currently using Windows 7 x64 - QtCreator 4.4.0 - Qtccppcheck 4.4.0

OneMoreGres commented 7 years ago

Just checked - works both suppression and exclusion. Try --suppress=*:*quazip.h in cppcheck's args or *quazip.h in plugin's settings.

gilprime commented 7 years ago

Thanks, the * before the file name in the --suppress argument solves the problem.