Missing documentation for code analysis for SWIFT app with task in azure-devops


i’m trying to dig the entire web without finding any solution for code analysis for SWIFT applications.

So far these are the additional properties (without counting the one for connecting to sonarcloud) i added to make the task (Prepare analysis configuration) work on azure devops:
scannerMode: ‘CLI’
configMode: ‘manual’
cliSources: ‘./directoryContainingSwiftFiles

Could you please provide me help and suggest which is the correct configuration for these 3 variables and if i need to add others to the task?

In sonar cloud, the analysis is done but without providing any result (no code is listed, like the directory where the code is located is completely empty).

I was able to get the analysis done in a different way: I had to run on bash on the host agent on azure devops. I already have .NET application being scanned with that task but for iOS apps written in swift i did not find anything…

Thank you in advance.
Romeo Morcia


Can you show us what your config looks like in the UI of the pipeline ?

Have you added the “Run Code Analysis” task as well ?


Which config you need to have precisely?

I’m using YML file for the pipeline configuration.

the tasks are these below (obviously just provided the taks itself without properties. The properties are filled properly but i need an example for SonarCloudPrepare so i can compare your solution working with mine)


XCode build



As workaround i used the C++ solution here: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/
I couldn’t find anything for Swift.

It would be nice to have the solution “out of the box” as there is for .NET applications.

Indeed if you use XCode build, then you will need to use the Build Wrapper, which will wrap your XCode build to hook it up and get proper analysis report.


So why isn’t there any documentation for that?
Shouldn’t be there a task for azure devops for this?

This made me loose more than one day of researching possibilities and testing on azure devops platform.

Is there any chance the build wrapper thingy can be added as a task of sonarcloud to azure devops?

Sorry @romeo.morcia after circling with one of my colleague, i was saying wrong with the build wrapper : For Swift code, the Scanner CLI invokation is sufficient.

That being said, the behavior you encounter is not necessarly the fault of your configuration.

Let’s take it back from the beginning.

Could you please share the log of the Run Code Analysis task please ? Ideally with debug mode enabled. And tell me if you want to share it privately.


I would like to share it privately. Where i can send it to you?

Solution was that I was trying to analyze branch directly instead of master.
Additionally, added pull analyze and it works properly now. Still missing the proper documentation, jira ticket created: https://jira.sonarsource.com/browse/SONARSWIFT-448