I'm having trouble getting cppcheck to recognize and apply my custom XML rules file. I've followed the documentation and advice, but still, cppcheck doesn't seem to trigger any warnings based on my rules. I'm wondering if anyone else has encountered similar issues or has any insights into why cppcheck might not be accepting my XML rules file. Could there be any specific configurations or troubleshooting steps I should consider?
my command in my command line is:
cppcheck --rule-file=C:\job\testcppcheck\xmltest.xml file.cpp
with xml:
<?xml version="1.0" ?>
<codingRules>
<rule>
<pattern>variable</pattern>
<message>
<severity>error</severity>
<summary>This variable . . .</summary>
</message>
</rule>
</codingRules>
According to cppcheck
writing-rules-1.docbookand cppcheck rule example files your rule grouping by<codingRules>element won't work.Either don't use a grouping element
or use
<rules>element for groupingWith the rule files above I get the expected cppcheck output
Processing rule: variabletest.cpp:3:0: error: This variable . . . [rule]for a simple test source file which contains matching patternvariable. With the rules file of question there is no additional cppcheck output.I use official cppcheck release v2.11 (Windows x64). If you create your own cppcheck build make sure HAVE_RULES option is enabled.