I have a large cmake project and I'd like to integrate cppcheck into my IDE/editor. From cmake it's easy to generate all required compiler flags into compile_commands.json. This is then easliy loaded into cppcheck (on commandline) but this also automatically scans all files defined in the json file. Ideally, I'd like to run cppcheck on a single file but using the compiler flags from compile_commands.json on the command line. Is this somehow possible? I could find a way yet.
Additionally, is it possible to load the compile_commands.json in the cppcheck-gui?
I'm using the linux version.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
do you feel that this feature is needed in the GUI also? I envision that this is something you would only use for quick tests of some file. So configuration in a GUI project file would seem overkill. Or what do you say..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Daniel,
yeah i found the solution yesterday while I was reading the code to try to implement it myself.
I actually use it with ALE(Asynchronus Linting Engine) https://github.com/dense-analysis/ale, a plugin for VIM, so I only need it a file at a time, and it would give me the results fairly quickly, instead of waiting for some time each time the command is ran, but I had to modify the plugin to incorporate the --file-filter into it.
I am not familiar with gui tools in general, but if they do have something similar, --live cheching the code-- , instead of a report style, then it would be useful.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a large cmake project and I'd like to integrate cppcheck into my IDE/editor. From cmake it's easy to generate all required compiler flags into compile_commands.json. This is then easliy loaded into cppcheck (on commandline) but this also automatically scans all files defined in the json file. Ideally, I'd like to run cppcheck on a single file but using the compiler flags from compile_commands.json on the command line. Is this somehow possible? I could find a way yet.
Additionally, is it possible to load the compile_commands.json in the cppcheck-gui?
I'm using the linux version.
yes that is a feature we should have. make it possible to scan specific files using settings from compile database.
yes. in the project settings.
Hi,
Was anything done for this? It is something I'd like too :)
Hi,
I would like this feature too !
Last edit: alfred 2020-09-12
On the command line you now have that feature. See
--file-filter
.do you feel that this feature is needed in the GUI also? I envision that this is something you would only use for quick tests of some file. So configuration in a GUI project file would seem overkill. Or what do you say..
Thanks Daniel,
yeah i found the solution yesterday while I was reading the code to try to implement it myself.
I actually use it with ALE(Asynchronus Linting Engine) https://github.com/dense-analysis/ale, a plugin for VIM, so I only need it a file at a time, and it would give me the results fairly quickly, instead of waiting for some time each time the command is ran, but I had to modify the plugin to incorporate the --file-filter into it.
I am not familiar with gui tools in general, but if they do have something similar, --live cheching the code-- , instead of a report style, then it would be useful.