Home > Enterprise >  Cppcheck ignores -i and checks all files after clean build
Cppcheck ignores -i and checks all files after clean build

Time:11-01

My project has pretty complex structure. It looks something like this:

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

I am building it using CMake with extra compile_commands.json.

In order to run CppCheck I am using VsCode task that runs this (massive) command:

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

Does that mean that -i is not recursive? That would be strange, because when adding folders they are added recursively.

I would be very thankful for any help.

CodePudding user response:

The problem was that .h files where still checked, despite -i flag. Solution:

--supress-lists=suppressions.txt

suppressions.txt

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

Important note!

path in suppressions MUST be full, relative doesn't work for some reason. It is kinda problematic for a project with multiple devs. Some script that will auto-generate this file is needed.

  • Related