Cppcheck 忽略 -i 并在干净构建后检查所有文件

Cppcheck ignores -i and checks all files after clean build

我的项目结构非常复杂。 它看起来像这样:

App/
   Inc/
   Src/
OtherDir/
   ManyOtherDirsInc/
   ManyOtherDirsSrc/
   OtherDirs/ThatAre/Inside/OtherDirs/Inc
build/

我正在使用带有额外 compile_commands.json 的 CMake 构建它。

为了 运行 CppCheck,我正在使用 VsCode 任务 运行 这个(大量)命令:

cppcheck --addon=${workspaceFolder}/misra.json
--cppcheck-build-dir=${workspaceFolder}/build 
-D__GNUC__ --enable=warning,style,performance,portability,information
--suppress=missingIncludeSystem --suppress=unmatchedSuppression
--project=${workspaceFolder}/build/compile_commands.json
-i${workspaceFolder}/ParentFolderOfManyOtherDirs/WithOtherDirsInside
-i${workspaceFolder}/OtherDirs/ThatAlsoShouldBeRecursivelyIgnored
--quiet --template=gcc --verbose

这是否意味着 -i 不是递归的?那会很奇怪,因为在添加文件夹时它们是递归添加的。

如有任何帮助,我将不胜感激。

问题是 .h 文件仍然被检查,尽管有 -i 标志。 解决方案:

--supress-lists=suppressions.txt

suppressions.txt

*:/home/Projects/Full/Path/*

重要提示!

抑制中的路径必须是完整的,相对的由于某种原因不起作用。对于具有多个开发人员的项目来说有点问题。需要一些自动生成此文件的脚本。