Fix/filter out duplicate suppressions - #96
Closed
davidramnero wants to merge 7 commits into
Closed
Conversation
…rity level is changed
ludviggunne
reviewed
Jul 27, 2026
| // Duplicate suppressions returns an error from cppcheck, so for ease of use we filter these out | ||
| const projectFileSuppressions = await parseSuppressionsFromProjectFile(cppcheckProjectFileUri); | ||
| for (const projectFileSuppression of projectFileSuppressions) { | ||
| const duplicateSuppressionIndex = args.findIndex((a) => a === `--suppress=${projectFileSuppression}`); |
There was a problem hiding this comment.
Unfortunately it's not enough to look at the id, here is the code to detect duplicates in cppcheck:
bool isSameParameters(const Suppression &other) const {
return errorId == other.errorId &&
fileName == other.fileName &&
lineNumber == other.lineNumber &&
symbolName == other.symbolName &&
hash == other.hash &&
thisAndNextLine == other.thisAndNextLine;
}Only id, file and line number can be supplied on the command line though, so should be enough to check those.
There was a problem hiding this comment.
These are the possible formats for --suppress=:
[error id]:[filename]:[line]
[error id]:[filename2]
[error id]
There was a problem hiding this comment.
It's maybe a bit unnecessary to have this logic in both places though, I think it would be good to have a --ignore-duplicate-suppressions option instead. I can create a ticket.
There was a problem hiding this comment.
Collaborator
Author
There was a problem hiding this comment.
okay makes sense, I'll close this PR for now then
Collaborator
Author
|
we'll sort duplicates handling in cppcheck instead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.