SonarCloud - Swift Code Coverage Showing 0%

  • ALM used - Azure Devops
  • CI system used - Azure Devops and fastlane
  • Scanner command used when applicable - Pipeline tasks:
  1. task: SonarCloudPrepare@1
    SonarCloud: “SonarCloud”
    organization: -----------
    scannerMode: “CLI”
    configMode: “manual”
    cliProjectKey: ---------
    cliProjectName: ----------
    cliSources: “.”
    coverageReportPaths: sonarqube-generic-coverage.xml
    extraProperties: |
  2. Run tests with fast lane**
  3. task: Bash@3
    displayName: “Sonar Code Coverage”
    targetType: inline
    script: ./ ./output/Logs/Test/*.xcresult/ > ./sonarqube-generic-coverage.xml
  4. task: SonarCloudAnalyze@1
  5. task: SonarCloudPublish@1
    pollingTimeoutSec: “300”
  • Languages of the repository - Swift
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
    The SonarCloud coverage report (sonarqube-generic-coverage.xml) is generated and it is populated as expected. However after publishing, it still shows 0% coverage for that analysis.

In the logs, I do see:
DEBUG: ‘Generic Coverage Report’ skipped because one of the required properties is missing
DEBUG: ‘Generic Test Executions Report’ skipped because one of the required properties is missing

  • Steps to reproduce
  • Potential workaround

Hey there.

coverageReportPaths is not a valid option for the task – you should pass sonar.coverageReportPaths to the extraProperties.

That fixed it.

Is there documentation for the azure pipeline tasks?

Hey @roanutil

You can find documentation for the SonarScanner for Azure DevOps here – although the YAML syntax is not precisely documented.