Search code examples
sonarqubesonar-runnercppcheck

c++ community manager sonar plugin failing to parse cppcheck report


I am trying to parse cppcheck report in sonar using c++ community plugin. I got the following error

INFO  - Sensor CxxCppCheckSensor
DEBUG - Normalized report includes to '[C:\Program Files (x86)\Jenkins\workspace\IHM TR\cppCheckTmp.xml]'
DEBUG - Adding report 'C:\Program Files (x86)\Jenkins\workspace\IHM TR\cppCheckTmp.xml'
INFO  - Processing report 'C:\Program Files (x86)\Jenkins\workspace\IHM TR\cppCheckTmp.xml'
INFO  - Parsing 'Cppcheck V2' format
INFO  - Parsing 'Cppckeck V1' format
ERROR - Report C:\Program Files (x86)\Jenkins\workspace\IHM TR\cppCheckTmp.xml cannot be parsed
INFO  - CppCheck Errors processed = 2403
INFO  - Sensor CxxCppCheckSensor (done) | time=1512ms

I guess the 2403 errors come from previous valid parsing.

I run cppcheck on a windows command line with this command

"C:\Program Files\Cppcheck\cppcheck.exe" --xml-version=2 --platform=win64 --force --enable=all --suppress=variableScope .  2> cppCheckTmp.xml

Then sonar with this

C:\sonar-runner\bin\sonar-runner.bat -e -Dsonar.host.url=http://10.85.32.203:9000 "-Dproject.settings=C:\Program Files (x86)\Jenkins\workspace\IHM TR\sonar-project.properties" "-Dsonar.projectBaseDir=C:\Program Files (x86)\Jenkins\workspace\IHM TR"

Do you have any clue to investigate why the parsing fail ?

Configuration

C++ community plugin version : v0.9.5

Jenkins, sonar and cppcheck running and installed on windows serveur 2008 R2


Solution

  • I found the solution. Previously, I wasn't able to detect where the error came from in the 10.000 lines cppCheck xml report.

    I opened the xml report with Google Chrome which nicely gave me column and line of the error. This is an encoding problem on a unused file with an accent. Here is the error xml report line. I finally deleted the file.