Code coverage not showing in SonarQube

When we run the Azure DevOps iOS pipeline, we encountered an issue with SonarQube. Although the pipeline was completed successfully, it did not display any code coverage on the SonarQube dashboard due to the Swift-plugin.

Error Message -
[Fatal Error] coverage-04.dtd:1:2: The markup declarations contained or pointed to by the document type declaration must be well-formed.

ERROR: Error processing file named sonar-reports/coverage-swift.xml
org.xml.sax.SAXParseException: The markup declarations contained or pointed to by the document type declaration must be well-formed.

This issue is related to the Swift plugin and the coverage.xml file. The community edition does not support Swift, so we installed the Swift plugin with a custom Sonar image. It was working fine until a few days ago, but now it is causing problems.

XCODE version
/Applications/Xcode_15.3.app/Contents/Developer
Xcode 15.3
Build version 15E204a
SonarQube version

  • Community Edition
  • Version 8.5.1 (build 38104)
    Sonarscaner version
    INFO: SonarScanner 5.0.1.3006
    INFO: Java 17.0.7 Eclipse Adoptium (64-bit)
    INFO: Mac OS X 14.4.1 x86_64
    error logs
    INFO: Sensor Surefire [backelitesonarswiftplugin] (done) | time=110ms

INFO: Sensor Cobertura [backelitesonarswiftplugin]

INFO: Processing Cobertura report sonar-reports/coverage-swift.xml

[Fatal Error] coverage-04.dtd:1:2: The markup declarations contained or pointed to by the document type declaration must be well-formed.

ERROR: Error processing file named sonar-reports/coverage-swift.xml

org.xml.sax.SAXParseException: The markup declarations contained or pointed to by the document type declaration must be well-formed.

at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)

at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)

at java.xml/javax.xml.parsers.DocumentBuilder.parse(Unknown Source)

at com.backelite.sonarqube.swift.coverage.CoberturaReportParser.parseReport(CoberturaReportParser.java:60)

at com.backelite.sonarqube.swift.coverage.CoberturaSensor.execute(CoberturaSensor.java:69)

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:82)

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:393)

at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)

Hey there.

Your version is past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

8.5.1 → 8.9.10 → 9.9.4 → 10.5.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Finally, if you’re using the Community Edition, that means you’re probably using GitHub - Idean/sonar-swift: Open source Swift plugin for SonarQube (also supports Objective-C), and should raise an issue with the maintainer to understand more about what is supported regarding coverage.

Hi Colin I have tried to Sonarqube version 9.9. We are facing the same issue.

Thanks. In that case, I refer you back to this:

Hi Colin,
Any update regarding this issue?