SonarScanner error parsing XML covfile from Bullseye

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    • SonarScanner CLI (windows) 4.7.0.2747
    • BullseyeCoverage 8.25.11
    • VS 2022 17.1.3
  • what are you trying to achieve
    • Analysis of simple test project using SonarScanner with BullseyeCoverage integration.
  • what have you tried so far to achieve this
    • build+test+scan using the aforementioned tools/versions

Hi folks!

I’m testing out an integration of the SonarScanner CLI with BullseyeCoverage, and am running into an error with the scanner parsing the XML file generated by Bullseye’s covxml tool:

ERROR: Error during SonarScanner execution
com.sonar.cpp.plugin.visualstudio.XmlParserHelper$ParseErrorException: Missing attribute "event" in element <probe> in C:\Users\eofenstein\Development\BOP\psdk-jenkins-builder\build\bullseye.cov.xml at line 4633
        at com.sonar.cpp.plugin.visualstudio.XmlParserHelper.parseError(XmlParserHelper.java:125)
        at com.sonar.cpp.plugin.visualstudio.XmlParserHelper.getRequiredAttribute(XmlParserHelper.java:91)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseProbeBlock(BullseyeParser.java:158)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseSrc(BullseyeParser.java:132)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:110)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:105)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:105)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:105)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:105)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parseFolderSrc(BullseyeParser.java:105)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.dispatchTags(BullseyeParser.java:71)
        at com.sonar.cpp.plugin.bullseye.BullseyeParser.parse(BullseyeParser.java:54)
        at com.sonar.cpp.plugin.bullseye.BullseyeSensor.execute(BullseyeSensor.java:48)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:79)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:382)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:378)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:347)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Pretty straightforward stuff, and manually adding a event="none" attribute to the probe element in question resolves the error.

It is unclear in the Bullseye documentation whether this attribute is guaranteed to be present or not, so it’s not immediately apparent whether this is a BullseyeCoverage or SonarScanner bug. In either case, it might make sense for the scanner parser to have a sane default in the event that the attribute is not present.

Edit: Please disregard the above. It is stated in the documentation referenced that:

When the `kind` attribute has value `"constant"` , there is no `event` attribute

That is the case here, so it is clear that the BullseyeCoverage XML is correct, and that the SonarScanner parser should not be requiring the attribute.

Hi @eof
Can you, please, share which version of CFamily analyzer you are using?
This is a recent change in the bullseye format, and it is supported starting from the version 6.29 of CFamily analyzer: CPP-3386.

Ah, I suspect that’s the issue then. We’re a few versions behind on our Sonarqube instance, which is on Developer Edition 9.0.1 (build 46107). I’ll have our site folks update it and report back.