Fix per file excludes#1437
Merged
danmar merged 5 commits intoOct 18, 2018
Merged
Conversation
--show-suppressed-rules will print rules in the suppression rule list to the console sorted by rule number.
The entire file scope suppression check was checking for the rule item list to be None instead of looking for None as an entry into the list. Correct this check and modify the documentation to explicitly state that an entry of None in the rule item list will set the scope for that suppression to be the entire file.
To run: ../../cppcheck --suppressions-list=suppressions.txt --dump misra-suppressions*-test.c python ../misra.py misra-suppressions*-test.c.dump There should be no violations reported
For environments that run cppcheck from the build system cppcheck may be passed a filename that is a complete path. Often this path will include a portion that is specific to the developer or to the environment where the project is located. The per-file suppression rules do filename matching based on the filename passed to cppcheck. To match any path information also has to be included into the suppressions file provided to cppcheck via the --suppressions-list= option. This limits the usefulness of the per-file based suppressions because it requires the suppression to be customized on a per instance basis. Add a option "--file-prefix" that allows a prefix to be excluded from the file path when doing the suppression filename matching. Example. Given the following structure: /test/path1/misra-suppressions1-test.c /test/path1/misra-suppressions2-test.c specifying --file-prefix /test/path1 will allow the use of misra-suppressions1-test.c and misra-suppressions2-test.c as filenames in the suppressions file without leading patch information but still match the suppression rule.
To run:
../../cppcheck --suppressions-list=suppressions.txt \
--dump misra-suppressions*-test.c \
path1/misra-suppressions*-test.c
python ../misra.py misra-suppressions*-test.c.dump \
path1/misra-suppressions*-test.c
There should be no violations reported
Contributor
Author
|
:) The Codacy quality reviewer doesn't like my misra test files. |
Collaborator
|
ok hmm codacy should ignore the test folders. |
Contributor
Author
|
@danmar Since you are squashing my commits into a single commit would you prefer I create that PR that way from the start? If so I will re-format the commit message differently so they read better. |
Collaborator
|
yes that would be preferable. |
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.
@danmar More testing found a few issues with the per-file suppressions.
@orbitcowboy I added new test files that allow for the testing of various forms of suppression.