Sonarqube not scanning swift in xcode project

Hi community

I’m trying to use Sonarqube with xcode to check swift code

Sonarqube server is working fine and I was able to ran scanner for the xcode project

But when I’m running the scanner , I keep seeing this on the server :

The main branch of this project is empty.

Below, I’m attaching some of the printed logs in the terminal and after it I’m sharing sonar-project keys

Logs :

INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.17 Eclipse Adoptium (64-bit)
INFO: Mac OS X 12.5 x86_64
INFO: User cache: /Users/user/.sonar/cache
INFO: Analyzing on SonarQube server 9.9.0.65466
INFO: Default locale: "en_PS", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=74ms
INFO: Server id: 147B411E-AYaSuBRI9Ra45onsIw_Z
INFO: User cache: /Users/user/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=46ms
INFO: Load/download plugins (done) | time=173ms
INFO: Process project properties
INFO: Process project properties (done) | time=11ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: com.test.project
INFO: Base dir: /Users/user/Test/Test
INFO: Working dir: /Users/user/Test/Test/.scannerwork
INFO: Load project settings for component key: 'com.test.project'
INFO: Load project settings for component key: 'com.test.project' (done) | time=20ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=126ms
INFO: Load active rules
INFO: Load active rules (done) | time=1124ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=6ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=13ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/*.xml, Pods/**/*, Reports/**/*, *.swift
INFO:   Included tests: *.swift
INFO: 547 files indexed
INFO: 193 files ignored because of inclusion/exclusion patterns
INFO: 23 files ignored because of scm ignore settings
INFO: Quality profile for json: Sonar way
INFO: ------------- Run sensors on module Test porject
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=49ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
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
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
INFO: Sensor IaC CloudFormation Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=149ms
INFO: Sensor IaC Kubernetes Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=55ms
INFO: Sensor CSS Rules [javascript]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [javascript] (done) | time=2ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
INFO: Sensor C# Analysis Log [csharp]
INFO: Sensor C# Analysis Log [csharp] (done) | time=14ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=4ms
INFO: Sensor TextAndSecretsSensor [text]
INFO: 378 source files to be analyzed
INFO: 378/378 source files have been analyzed
INFO: Sensor TextAndSecretsSensor [text] (done) | time=953ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=10ms
INFO: Sensor VB.NET Analysis Log [vbnet]
INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=28ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor IaC Docker Sensor [iac]
INFO: 0 source files to be analyzed
INFO: 0/0 source files have been analyzed
INFO: Sensor IaC Docker Sensor [iac] (done) | time=91ms
INFO: ------------- Run sensors on project
INFO: Sensor Analysis Warnings import [csharp]
INFO: Sensor Analysis Warnings import [csharp] (done) | time=1ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=13ms
INFO: CPD Executor Calculating CPD for 0 files
INFO: CPD Executor CPD calculation finished (done) | time=0ms
INFO: Analysis report generated in 121ms, dir size=122.4 kB
INFO: Analysis report compressed in 21ms, zip size=14.9 kB
INFO: Analysis report uploaded in 34ms
INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://localhost:9000/dashboard?id=com.test.project
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AYajdpqZKKP99KntDkGL
INFO: Analysis total time: 6.691 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 8.761s
INFO: Final Memory: 17M/70M

sonar-project :

sonar.host.url=http://localhost:9000
# sonar.login=admin
# sonar.password=admin

sonar.projectKey=com.test.project
sonar.projectName=Test Project


sonar.swift.project=Test.xcodeproj
sonar.swift.workspace=Test.xcworkspace

# Number version (can be found automatically in plist, just comment this line)
sonar.projectVersion=1.0
sonar.language=swift
sonar.projectDescription=Project Description
sonar.sources=Test

sonar.swift.simulator=platform=iOS Simulator,name=iPhone 8,OS=13.0

sonar.swift.appName=Test
sonar.swift.appScheme=Test
sonar.sourceEncoding=UTF-8
sonar.swift.excludedPathsFromCoverage=.*Tests.*

sonar.sources=Test

Hi,

Can you share the Scanner Context - redacted as necessary - from the most recent analysis? You’ll find it at: Project Settings → Background Tasks → [analysis row cog menu] → Show Scanner Context

 
Ann

Sure, here is the logs
I can’t see swift under it

Plugins:
Bundled analyzers:
  - Python Code Quality and Security 3.24.0.10784 (python)
  - Go Code Quality and Security 1.11.0.3905 (go)
  - JaCoCo 1.3.0.1538 (jacoco)
  - Kotlin Code Quality and Security 2.12.0.1956 (kotlin)
  - IaC Code Quality and Security 1.11.0.2847 (iac)
  - JavaScript/TypeScript/CSS Code Quality and Security 9.13.0.20537 (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.51.0.59060 (csharp)
  - Java Code Quality and Security 7.16.0.30901 (java)
  - HTML Code Quality and Security 3.7.1.3306 (web)
  - Flex Code Quality and Security 2.8.0.3166 (flex)
  - XML Code Quality and Security 2.7.0.3820 (xml)
  - PHP Code Quality and Security 3.27.1.9352 (php)
  - Text Code Quality and Security 2.0.1.611 (text)
  - VB.NET Code Quality and Security 8.51.0.59060 (vbnet)
  - Configuration detection fot Code Quality and Security 1.2.0.267 (config)
Global server settings:
  - sonar.core.id=147B411E-AYaSuBRI9Ra45onsIw_Z
  - sonar.core.startTime=2023-03-02T02:10:41+0200
  - sonar.forceAuthentication=true
  - sonar.projectCreation.mainBranchName=develop

Hi,

What edition are you running? If you’re not sure, you can check your page footer.

Swift analysis starts in Developer Edition($).

 
Ann