Sonar not show coverage in ios swift project

Hello All,

When I try to upload my coverage with below command
sonar-scanner -Dsonar.projectKey=xyz-Dsonar.coverageReportPaths=Coverage.xml -Dsonar.host.url=http://localhost:9000 -Dsonar.token=sqp_ae6aa295e1ba0e92c844444ccfffc06453b5135a

it is executed successfully when I go on local server ui with below URL http://localhost:9000 on browser my scanned code & coverage % not show. Please find the attache screen shots.


Thanks,
Ankit Jain

What do the logs say about importing coverage data?

SonarErrorLog.txt (1.9 MB)

Please find the attached error log

Ah, here’s what’s going on.

11:28:47.000 INFO  Sensor Generic Coverage Report\
11:28:47.000 INFO  Parsing /Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/Coverage.xml\
11:28:47.074 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/CommonUtils.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.076 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/ConfigCalls.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.077 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/CsvOperation.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.077 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/DeviceProfile.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.077 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/DeviceRegistration.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.078 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/FeedbackSyncUser.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.078 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/API/SyncSpeedTestResults.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.078 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/AppSharedData.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.093 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/Config.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.093 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/FeedBackAPI/FeedBackAPI.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.095 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/FeedBackAPI/FeedBackInfo.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.096 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SDKConfiguration.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.096 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/SpeedTestAPI.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.100 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/SpeedTestLastRecord.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.101 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/SpeedTestResult.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.101 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/TestViewUtils/Download.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.102 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/TestViewUtils/LatencyUtils.m' in the generic coverage report because it doesn't have a known language\
11:28:47.103 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/TestViewUtils/NetworkManager.m' in the generic coverage report because it doesn't have a known language\
11:28:47.103 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/TestViewUtils/PostController.m' in the generic coverage report because it doesn't have a known language\
11:28:47.105 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/SpeedTestAPI/TestViewUtils/SimplePing.m' in the generic coverage report because it doesn't have a known language\
11:28:47.106 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/CommonUtilsTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.107 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/ConfigCallsTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.107 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/NVIOSConstantTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.107 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/mySDKAppShareDataTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.107 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/mySDKFeedBackSDKDeviceTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.107 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/mySDKSwiftXMLParserTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.108 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/mySDKTests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.109 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/mySDKUtility.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.109 DEBUG Skipping file '/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDKTests/SpeedTestAPITests.swift' in the generic coverage report because it doesn't have a known language\
11:28:47.150 INFO  Imported coverage data for 0 files\
11:28:47.150 INFO  Coverage data ignored for 211 unknown files, including:\
/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/3rdParty/Constants.swift\
/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/3rdParty/Encryption/AESCrypt/AESCrypt.m\
/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/3rdParty/Encryption/AESCrypt/NSData+Base64.m\
/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/3rdParty/Encryption/AESCrypt/NSData+CommonCrypto.m\
/Users/username/MyData/myApp/SDK/Kiba/Sonar Code/myApp-sdk-ios/mySDK/3rdParty/Encryption/AESCrypt/NSString+Base64.m\
11:28:47.150 INFO  Sensor Generic Coverage Report (done) | time=150ms\

Your logs indicate that you’re using Community Build. Swift analysis is only available in the Developer Edition of SonarQube Server and above, and on SonarQube Cloud (Free and Paid tiers)

Developer Edition is not free and SonarQube Cloud free only for 14 days am I right ?

There is also now a free tier which allows you 50k private lines of code, along with some other limitations – The new SonarQube free tier is here - get started today!

However Swift analysis is available. :slight_smile:

And based on this screenshot you have 42k Lines of Code, so it might be a great option!