1

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 &apos;&apos; is accessed at non-zero index." verbose="The address of variable &apos;&apos; is accessed at non-zero index." cwe="758"/>
        <error id="argumentSize" severity="warning" msg="Buffer &apos;buffer&apos; is too small, the function &apos;function&apos; expects a bigger buffer in 2nd argument" verbose="Buffer &apos;buffer&apos; is too small, the function &apos;function&apos; expects a bigger buffer in 2nd argument" cwe="398">
            <symbol>function</symbol>
        </error>
3
  • 1
    It's documented here: cppcheck.sourceforge.io/manual.html#html-report Alternatively, you can write an XSLT that converts the XML report to HTML. Commented Jul 16, 2024 at 7:34
  • Thanks @howlger, I Googled cppcheck manual and it never came up in Google that is why I missed it. Do you know where inEclipse I can add those command-line arguments so that when I run cppcheck in Eclipse it runs those arguments to generate the HTML report? Commented Jul 21, 2024 at 2:23
  • You might add it as a so-called external tool: Run > External Tools > External Tools Configurations... Commented Jul 22, 2024 at 8:52

1 Answer 1

0

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?.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.