enh(ci): Unhardcode some of CppCheck command line options
Description
sight!736 (closed) still has some benign CppCheck warnings: One because IGTLCommon_EXPORT
isn't recognized, and another because unmatchedSuppression
warning correctly suppressed (it seems to suppress it one must suppress both unmatchedSuppression
and unmatchedSuppression:*
).
Right now, the suppressed warnings list is hardcoded inside Sheldon, but CppCheck supports providing the list of suppressed warnings list in a file, so we could provide a different list for different projects as well as modify this list without needing to modify Sheldon.
Remember that, as opposed to Clang-tidy, CppCheck doesn't require a compilation database, so some defines that would be generated by CMake have to be provided on CppCheck command line. This list of defines can be provided on a file as well, so we could provide a different list for different projects without having to modify Sheldon.
Proposal
Optional section to give some functional or technical hints
Functional specifications
Workflow, UX/UI design, screenshots, etc...
- CppCheck hook will now seek the suppressed warnings list in
.cppcheck/suppressed-warnings.txt
. - CppCheck hook will now seek the defines in
.cppcheck/defines.hpp
.
Technical specifications
Details of the implementation
- Remove the
--suppress=...
options from CppCheck command line and replace them with--suppressions-list=.cppcheck/suppressed-warnings.txt
if this file exists. - Remove the
-D...
options from CppCheck command line and replace them with--include=.cppcheck/defines.hpp
if this file exists.
Test plan
- Execute CppCheck on sight!736 (closed) => There are no more warnings
- Execute CppCheck on sight dev => There are still warnings