Imported coverage data for 0 files

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube - Community Edition v10.7 (96327)
    Scanner - 6.2.1.4610
  • how is SonarQube deployed: zip, Docker, Helm
    Docker
  • what are you trying to achieve
    I’m trying to upload code coverage report of Swift (Xcode) project using ‘sonar.coverageReportPaths’
  • what have you tried so far to achieve this
    Executed Following commands as part of sh run-sonar-swift.sh -v

xcodebuild clean build -workspace SonarSwiftSample.xcworkspace -scheme SonarSwiftSample -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' -destination-timeout 360 COMPILER_INDEX_STORE_ENABLE=NO

xcodebuild clean build test -workspace SonarSwiftSample.xcworkspace -scheme SonarSwiftSample -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' -destination-timeout 60

slather coverage --binary-basename SonarSwiftSample --input-format profdata --sonarqube-xml --output-directory sonar-reports --workspace SonarSwiftSample.xcworkspace --scheme SonarSwiftSample SonarSwiftSample.xcodeproj

sonar-scanner

Below is the output for sonar-scanner

23:21:23.870 INFO Scanner configuration file: /opt/homebrew/Cellar/sonar-scanner/6.2.1.4610/libexec/conf/sonar-scanner.properties
23:21:23.873 INFO Project root configuration file: /Users/myuser/SonarSwiftSample/sonar-project.properties
23:21:23.886 INFO SonarScanner CLI 6.2.1.4610
23:21:23.887 INFO Java 23 Homebrew (64-bit)
23:21:23.889 INFO Mac OS X 15.0.1 aarch64
23:21:23.926 INFO User cache: /Users/vigneshjeyaraj/.sonar/cache
23:21:24.432 INFO JRE provisioning: os[macos], arch[arm64]
23:21:24.608 INFO Communicating with SonarQube Server 10.7.0.96327
23:21:24.868 INFO Starting SonarScanner Engine…
23:21:24.869 INFO Java 17.0.11 Eclipse Adoptium (64-bit)
23:21:25.410 INFO Load global settings
23:21:25.473 INFO Load global settings (done) | time=62ms
23:21:25.474 INFO Server id: 147B411E-AZMLwrI1dRsWq8c-BgKu
23:21:25.480 INFO Loading required plugins
23:21:25.480 INFO Load plugins index
23:21:25.493 INFO Load plugins index (done) | time=14ms
23:21:25.493 INFO Load/download plugins
23:21:25.519 INFO Load/download plugins (done) | time=25ms
23:21:25.671 INFO Process project properties
23:21:25.676 INFO Process project properties (done) | time=6ms
23:21:25.682 INFO Project key: com.example.SonarSwiftSample
23:21:25.683 INFO Base dir: /Users/myuser/SonarSwiftSample
23:21:25.683 INFO Working dir: /Users/myuser/SonarSwiftSample/.scannerwork
23:21:25.687 INFO Load project settings for component key: ‘com.example.SonarSwiftSample’
23:21:25.701 INFO Load project settings for component key: ‘com.example.SonarSwiftSample’ (done) | time=14ms
23:21:25.716 INFO Load quality profiles
23:21:25.808 INFO Load quality profiles (done) | time=92ms
23:21:25.829 INFO Load active rules
23:21:29.767 INFO Load active rules (done) | time=3939ms
23:21:29.770 INFO Load analysis cache
23:21:29.775 INFO Load analysis cache (404) | time=6ms
23:21:29.815 INFO Preprocessing files…
23:21:30.184 INFO 0 languages detected in 2 preprocessed files
23:21:30.184 INFO 2 files ignored because of inclusion/exclusion patterns
23:21:30.185 INFO 0 files ignored because of scm ignore settings
23:21:30.185 INFO Loading plugins for detected languages
23:21:30.185 INFO Load/download plugins
23:21:30.186 INFO Load/download plugins (done) | time=0ms
23:21:30.206 INFO Load project repositories
23:21:30.215 INFO Load project repositories (done) | time=10ms
23:21:30.220 INFO Indexing files…
23:21:30.220 INFO Project configuration:
23:21:30.221 INFO Included sources: /.swift
23:21:30.221 INFO Excluded sources: **/
.xml, Pods/
/, Reports/**/, /Test/
23:21:30.225 INFO 2 files indexed
23:21:30.225 INFO ------------- Run sensors on module SonarSwiftSample
23:21:30.241 INFO Load metrics repository
23:21:30.253 INFO Load metrics repository (done) | time=12ms
23:21:30.388 INFO Sensor JaCoCo XML Report Importer [jacoco]
23:21:30.389 INFO ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
23:21:30.389 INFO No report imported, no coverage information will be imported by JaCoCo XML Report Importer
23:21:30.389 INFO Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
23:21:30.389 INFO Sensor Java Config Sensor [iac]
23:21:30.398 INFO 0 source files to be analyzed
23:21:30.401 INFO 0/0 source files have been analyzed
23:21:30.401 INFO Sensor Java Config Sensor [iac] (done) | time=12ms
23:21:30.401 INFO Sensor IaC Docker Sensor [iac]
23:21:30.444 INFO 0 source files to be analyzed
23:21:30.444 INFO 0/0 source files have been analyzed
23:21:30.444 INFO Sensor IaC Docker Sensor [iac] (done) | time=43ms
23:21:30.444 INFO Sensor TextAndSecretsSensor [text]
23:21:30.444 INFO Available processors: 8
23:21:30.444 INFO Using 8 threads for analysis.
23:21:30.670 INFO Using git CLI to retrieve untracked files
23:21:30.769 INFO Analyzing language associated files and files included via “sonar.text.inclusions” that are tracked by git
23:21:30.769 INFO Sensor TextAndSecretsSensor [text] (done) | time=325ms
23:21:30.771 INFO ------------- Run sensors on project
23:21:30.848 INFO Sensor Generic Coverage Report
23:21:30.849 INFO Parsing /Users/myuser/SonarSwiftSample/coverage-swift.xml
23:21:30.857 INFO Imported coverage data for 0 files
23:21:30.857 INFO Coverage data ignored for 1 unknown files, including:
SonarSwiftSample/SonarSwiftSample.swift
23:21:30.857 INFO Sensor Generic Coverage Report (done) | time=9ms
23:21:30.857 INFO Sensor Zero Coverage Sensor
23:21:30.860 INFO Sensor Zero Coverage Sensor (done) | time=2ms
23:21:30.862 INFO CPD Executor Calculating CPD for 0 files
23:21:30.862 INFO CPD Executor CPD calculation finished (done) | time=0ms
23:21:30.868 INFO SCM revision ID ‘9921182b9e3725ca18755fa17a4f16f2f8a63a6b’
23:21:30.908 INFO Analysis report generated in 39ms, dir size=221.6 kB
23:21:30.919 INFO Analysis report compressed in 11ms, zip size=21.2 kB
23:21:30.945 INFO Analysis report uploaded in 25ms
23:21:30.946 INFO ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=com.example.SonarSwiftSample
23:21:30.946 INFO Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
23:21:30.946 INFO More about the report processing at http://localhost:9000/api/ce/task?id=2ebbca96-8031-49e5-80a7-698a39585514
23:21:30.950 INFO Analysis total time: 5.409 s
23:21:30.951 INFO SonarScanner Engine completed successfully
23:21:30.976 INFO EXECUTION SUCCESS
23:21:30.977 INFO Total time: 7.110s

  • returnValue=0
  • set +x

I have uploaded the sample project with all necessary file in Github here
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey there.

SonarQube Community Edition doesn’t support Swift (that starts in Developer Edition). It looks like you’re using a script provided by GitHub - Idean/sonar-swift: Open source Swift plugin for SonarQube (also supports Objective-C), but don’t actually have GitHub - Idean/sonar-swift: Open source Swift plugin for SonarQube (also supports Objective-C) installed on your SonarQube instance, which would explain why the coverage import isn’t recognizing any Swift files.

If you have any trouble using that community-supported plugin, it’s probably best that you raise an issue with the maintainer.

Hi Colin,

I’m trying to use generic coverage report using sonar property without Swift plugin support
sonar.coverageReportPaths=coverage-swift.xml

Following is my complete sonar properties,

sonar.host.url=http://localhost:9000
sonar.token=MyTokenGoesHere
sonar.projectKey=com.example.SonarSwiftSample
sonar.projectName=SonarSwiftSample
sonar.projectVersion=1.0.0
sonar.projectDescription=This is the Sonar demo application for the code quality check
sonar.sources=SonarSwiftSample,SonarSwiftSampleTests
sonar.test=**/*Test*/*.swift
sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*,**/*Test*/**
sonar.inclusions=**/*.swift
sonar.tests=SonarSwiftSampleTests
sonar.sourceEncoding=UTF-8
sonar.coverageReportPaths=coverage-swift.xml

Is it possible to upload coverage report as generic test data?

No. Your SonarQube instance must support the language you’re trying to upload coverage data for, even when using the generic format.

1 Like