1

Is it possible to get output in XML format from Clang scan-build analyzer? Currently following command generates output in html format to view in webbrowser.

scan-build xcodebuild -configuration Debug -sdk iphonesimulator

CppCheck on windows generate output in XML format. I need to parse result into same format as CppCheck. But I can't use cppCheck on MACOS. What I am trying to achieve is feed results into Sonar C++ Plugin so that I can create dashboard(continous integration) report of ObjectiveC project. Sonar C++ plugin uses CppCheck to static analyze the code.

Any input will greatly appreciated.

user2506411
  • 303
  • 1
  • 5
  • 10

2 Answers2

1

Running scan-build --help shows:

-plist         - By default the output of scan-build is a set of HTML files.
                 This option outputs the results as a set of .plist files.
Carl Norum
  • 219,201
  • 40
  • 422
  • 469
  • Thanks. It creates multiple .plist files per each class. For example in /tmp/scan-build-dir/ I can see lot of .plist files.Would it be possible to get just one .plist file with all static analysis results? – user2506411 Jun 21 '13 at 23:59
  • `scan-build` is just a perl script, IIRC. You should be able to modify it without too much effort. – Carl Norum Jun 23 '13 at 18:27
  • Modifying scripts installed via package management systems is frowned upon. – Folkert van Heusden Dec 17 '20 at 15:43
0

By default clang static analyzer outputs in xml format. scan-build want clang static analyzer to output in html and parses the html outputs to generate a summary of all the errors found by the static-anlayzer during the build process.

If you see the scan-build script, there is a PostProcess function when the output format is html. scan-build does not postprocess the plist files as of now. If you are familiar with XML you should be able to parse the XML (.plist) files and do a post processing to generate a summary.

A. K.
  • 34,395
  • 15
  • 52
  • 89