I have an Xcode Project, using the Swift language, with some Unit tests, that I am trying to export the coverage information to Sonar. I have faced some issues, but first of all…
- SonarQube 9.7.1
- SonarScanner 184.108.40.20647
- Java 220.127.116.11 Homebrew (64-bit)
- Mac OS X 12.6 x86_64
- Xcode 14.0
So far I tried some things:
1 - The generated sonarqube-generic-coverage.xml file came with some wrong characters: &. I had to remove this in order to the Sonar scanner works.
2 - After that the Sonar Scanner had been completed, but the coverage information was 0%. Checking the error/warning outputs I could realize that the following message appeared for every class:
DEBUG: Skipping file '<< MY CLASS >>'in the generic coverage report because it doesn’t have a known language.
The project language is swift, and its contemplated in the properties file:
There is no “-Dsonar.objc.file.suffixes=-” in my properties.
I have already tried lots of thins, but I am still not able to see my code coverage in the Sonar.
What should I do? Is there any updated tutorial about using Sonar to see the Swift Xcode project, coverage and etc?
I already appreciate
(G Ann Campbell)
Welcome to the community!
Can you share your analysis log?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Thanks for the answer!
The Swift Code Quality and Security Sensor is not appearing in the execution logs, neither skipped nor used (we are searching for the output file for the Swift Sensor right?).
It’s not possible to insert the whole execution log here because it crosses the character limit here in the post.
I found an analysis.log file in the PROJECT_FOLDER/.scannerwork/scanner-report/analysis.log. Don’t know if it helps
The content is:
- Python Code Quality and Security 18.104.22.16854 (python)
- Go Code Quality and Security 22.214.171.12405 (go)
- JaCoCo 126.96.36.1997 (jacoco)
- Kotlin Code Quality and Security 188.8.131.526 (kotlin)
- IaC Code Quality and Security 184.108.40.2069 (iac)
- Ruby Code Quality and Security 220.127.116.1105 (ruby)
- Scala Code Quality and Security 18.104.22.16805 (sonarscala)
- C# Code Quality and Security 22.214.171.124807 (csharp)
- Java Code Quality and Security 126.96.36.199229 (java)
- HTML Code Quality and Security 188.8.131.5206 (web)
- Flex Code Quality and Security 184.108.40.20665 (flex)
- XML Code Quality and Security 220.127.116.1186 (xml)
- PHP Code Quality and Security 18.104.22.16877 (php)
- Text file Code Quality and Security 22.214.171.1242 (text)
- VB.NET Code Quality and Security 126.96.36.199807 (vbnet)
- Configuration detection fot Code Quality and Security 188.8.131.527 (config)
Global server settings:
Project server settings:
Project scanner properties:
- sonar.swift.simulator=platform=iOS Simulator,name=iPhone SE (2nd generation),OS=15.0
- sonar.swift.tailor.config=--no-color --max-line-length=100 --max-file-length=500 --max-name-length=40 --max-name-length=40 --min-name-length=4
Thanks in advance
(G Ann Campbell)
What edition are you using? You can check in the page footer. I’m guessing you’re on Community Edition, which doesn’t include Swift.
Wow! I am definitely using Community version:
I didn’t know Swift language it was only included on payed versions.
(G Ann Campbell)
Prices for Developer Edition($), which includes Swift, are very reasonable for small instances.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.