* Modifiy check for MISRA rule 4.1 to avoid skipping constant character literal enclosed by single quotes.
Add test for MISRA rule 4.1 which contains non-compliant cases defined by MISRA C 2012 document.
* Moved additional test cases for MISRA rule 4.1 to appropriate test case section.
Without the `for scope in data.scopes:` loop, scope is not assigned anything.
From the context a loop over `data.scopes` could be intended. But other things like indentation would be possibly correct too. Not sure how this code should be.
We try this fix.
https://trac.cppcheck.net/ticket/8946
Add tests to travis script for verifying rule text loading.
Add dummy rule text files.
misra.py: Try to find a suitable codec for rule texts file.
* Added script to check ROS naming style
* Added header to script
* Enhanced namingng.py and added ROS_naming.json
* Correction of style bugs
* Removed trailing whitespace
* Removed trailing whitespace
* Removed path
* Remove path from file name
* Check if the token belongs to the current file or is included
* Reverted
* Fixed msg errors
* Added a new naming check addon. Also verifies variable and function prefixes
* Verification added to code
* added naming checks ng selftest to travis file
* Ensure zero exit value for tests if tests succeed
* Expected values adjusted
* Fixed copy and paste error
* MISRA: Allow printing of the suppressed rules to the console
--show-suppressed-rules will print rules in the suppression rule list to
the console sorted by rule number.
* MISRA: Correct rule suppression for entire file scope
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.
* MISRA: Tests for checking per-file rule suppressions
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
* MISRA: Allow ignoring a prefix from file paths when suppression matching
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.
* MISRA: Tests for --file-prefix option
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
Functions with variadic arguments trip an exception in the MISRA checker
because some of the token is None and does not have some of the members
the code is expecting.
Prevent this by checking to see if the token is None and skipping the
code that tries to use that value.