Reputation: 23
I am using Eclipse CDT for embedded development. I installed Cppcheck and the Eclipse plugin cppcheclipse for static analysis. When I run cppcheck in the IDE it generates xml data in the console.
I tried copying the data and created an xml file from it but it is still unreadable. There should be a way to have the IDE/cppcheck generate a human readable report so I can see what are all the errors and warings.
I tried Googling a solution, but the only one I found requires me to create a file for the command line cppcheck tool and requires me to download LibreOffice to do some conversion.
I do not want to have to run external command line tools and download programs I am not going to use. This seems like it should be an easy check box setting in Eclipse/cppcheck/cppcheclipse or I add some parameters to the list of command line arguments that get run when I invoke cppcheck.
I have tried adding to the advancewd settings but that also did not work.
In addition, where in Eclipse can I see the command line arguments that cppcheck uses when run from Eclipse? I cannot find it under workspace->preferences->cppcheclipse and project->properties->cppcheclipse.
Last question, I have tried rerunning cppcheck/cppcheclipse but it does not generate output anymore. It did it the first time, but no output since then.
Here is an example of the output:
<error id="bufferAccessOutOfBounds" severity="error" msg="Buffer is accessed out of bounds: buf" verbose="Buffer is accessed out of bounds: buf" cwe="788"/>
<error id="objectIndex" severity="error" msg="The address of variable '' is accessed at non-zero index." verbose="The address of variable '' is accessed at non-zero index." cwe="758"/>
<error id="argumentSize" severity="warning" msg="Buffer 'buffer' is too small, the function 'function' expects a bigger buffer in 2nd argument" verbose="Buffer 'buffer' is too small, the function 'function' expects a bigger buffer in 2nd argument" cwe="398">
<symbol>function</symbol>
</error>
Upvotes: 1
Views: 163
Reputation: 411
That is done via the cppcheck-htmlreport
Python tool.
It is possible that it available/packaged on every system. In that case you can simply pull the latest version from the official repository: https://github.com/danmar/cppcheck/tree/main/htmlreport. The script is standalone.
This was already pointed out by @howlger in a previous comment: How to generate a readable report from the xml output of Cppcheck/Cppcheclipse?.
Upvotes: 0