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…
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:
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.
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:
Plugins:
Bundled analyzers:
- Python Code Quality and Security 3.19.0.10254 (python)
- Go Code Quality and Security 1.11.0.3905 (go)
- JaCoCo 1.1.1.1157 (jacoco)
- Kotlin Code Quality and Security 2.10.0.1456 (kotlin)
- IaC Code Quality and Security 1.9.2.2279 (iac)
- JavaScript/TypeScript/CSS Code Quality and Security 9.9.0.19492 (javascript)
- Ruby Code Quality and Security 1.11.0.3905 (ruby)
- Scala Code Quality and Security 1.11.0.3905 (sonarscala)
- C# Code Quality and Security 8.46.0.54807 (csharp)
- Java Code Quality and Security 7.14.0.30229 (java)
- HTML Code Quality and Security 3.6.0.3106 (web)
- Flex Code Quality and Security 2.7.0.2865 (flex)
- XML Code Quality and Security 2.6.1.3686 (xml)
- PHP Code Quality and Security 3.25.0.9077 (php)
- Text file Code Quality and Security 1.1.0.282 (text)
- VB.NET Code Quality and Security 8.46.0.54807 (vbnet)
- Configuration detection fot Code Quality and Security 1.2.0.267 (config)
Global server settings:
- sonar.core.id=147B411E-AYSAvlDHcNkRtuup0yuI
- sonar.core.startTime=2022-12-02T16:29:34-0300
- sonar.forceAuthentication=true
Project server settings:
Project scanner properties:
- sonar.coverageReportPaths=sonarqube-generic-coverage.xml
- sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*
- sonar.host.url=http://localhost:9000
- sonar.language=Swift
- sonar.login=******
- sonar.password=******
- sonar.projectBaseDir=/Users/filiponegrao/projects/mobilidade-app-ios
- sonar.projectDescription=prjDescription
- sonar.projectKey=Teste-Renner
- sonar.projectName=Teste-Renner
- sonar.scanner.app=ScannerCLI
- sonar.scanner.appVersion=4.7.0.2747
- sonar.sourceEncoding=UTF-8
- sonar.sources=.
- sonar.swift.appConfiguration=Debug
- sonar.swift.appScheme=RennerMobile
- sonar.swift.excludedPathsFromCoverage=.*Tests.*
- sonar.swift.project=RennerMobile.xcodeproj
- 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
- sonar.swift.workspace=RennerMobile.xcworkspace
- sonar.test.inclusions=*.swift
- sonar.tests=LojasRennerUnitTests
- sonar.verbose=true
- sonar.working.directory=/Users/filiponegrao/projects/mobilidade-app-ios/.scannerwork