pocc/pre-commit-hooks

add_if_missing() does not allow multiple --suppress arguments

Closed this issue · 2 comments

Adding a --suppress to the args in the pre-commit-config.yaml like so args: ["--suppress=*:*test*"] will prevent the hook from adding the other default --suppress present in the cppcheck.py :
self.add_if_missing( ["--suppress=unmatchedSuppression", "--suppress=missingIncludeSystem", "--suppress=unusedFunction"] )
This is because the add_if_missing() function will see that a --suppress was already added in the args field so it will not add it again.

pocc commented

So far as I understand your question, this is working as intended. If you want to override the default options, this is the way that you can.

Why not use args: ["--suppress=*:*test*", "--suppress=unmatchedSuppression", "--suppress=missingIncludeSystem", "--suppress=unusedFunction"]?

pocc commented

Closing due to inactivity.