I am using SonarC-Scanner to do a analysis on my Objective-C code in Azure DevOps and upload results to SonarCloud.
We also have a Android project where we are scanning and uploading results to SonarCloud.
What I recently noticed was that the scan for our Android project requires no additional work setting parameters when it comes to PR’ids and branch names in SonarCloud, but in our Objective-C project we had to set the sonar.pullrequest.key parameter so that we would see the PR branch before merge’ing to master ( short lived branch ).
In our Android Project we see the description for the short lived branches as
[PR_id] - [PR_description]
But the default for the Objective-C project the naming is
[PR_id] - [PR_GIT path for example /refs/heads/fix-heading]
Is it the right way to set these parameters manually or is there something I am doing wrong when invoking the Sonar Scanner ?
This is my Sonar task in Azure DevOps:
- bash: |
(Build.SourcesDirectory)/sonar-scanner-4.2.0.1873-macosx/bin/sonar-scanner \ -Dsonar.host.url=<sonar host> \ -Dsonar.login=<sonar login> \ -Dsonar.projectKey=<project key> \ -Dsonar.cfamily.build-wrapper-output=(Build.SourcesDirectory)/bw_out
-Dsonar.verbose=true
-Dsonar.sources=(Build.SourcesDirectory) \ -Dsonar.c.file.suffixes=- \ -Dsonar.cpp.file.suffixes=- \ -Dsonar.objc.file.suffixes=.h,.m \ -Dsonar.organization=<org name> \ -Dsonar.projectVersion=(Build.MarketVersion)_(Build.BuildNumber) \ -Dsonar.pullrequest.key=(System.PullRequest.PullRequestId)
-Dsonar.pullrequest.branch=$(System.PullRequest.SourceBranch)
displayName: SonarCloud-Run-Scanner
Also, we set the personal access token in SonarCloud for Integration with Azure DevOps Services. That also works out of the box for our Android project but we do not get the update for the Objective-C project, so it seems that some properties are correctly configured.