Please find the below steps to implement sonarqube analysis for your Xamarin Project .
Requirements & Installation Steps :
1. MSBuild : MSbuild will be installed along with Mono already in your machine to verify, Please execute the below command in terminal * which msbuild * /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild 2. Install Brew (You might have it already). * ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" * To Check installation Open Terminal and Run "brew update" 3. Install Sonar : * brew install sonar * brew install sonar-scanner 3. Run Sonar In Terminal: "Sonar Console" :smile: 4. Login To Sonar In Local Machine: Open Browser and enter "http://localhost:9000" Login as admin, Password- admin 5. MSbuild for SonarQube : * As of today, the latest version 3.0.2 was not support to Mac OS, Killed my days * The SonarQube version should be > 4.0 +, ********In order to run on NON WINDOW OS Platform. ******** Found the answer in the below link https://groups.google.com/d/msg/sonarqube/wLaU3ijlqDk/YmETdAjmAgAJ * The latest release and download the plugin from - > https://docs.sonarqube.org/pages/viewpage.action?pageId=6954799 [Edited later] * Have it in your preferred location. 6. SonarC#. * One more Compatibility issue, The sonarQube 6.7 has the sonarC# Plugin 6.6 in administration -> marketplace, which was having issue in scanning C# code from mac. (Killed My Day Again) * If the version was updated by the time you read this, Please use that. You can find the official release version in. [https://docs.sonarqube.org/pages/viewpage.action?pageId=1441900] * SonarC# Plugin Download [https://github.com/SonarSource/sonar-csharp/releases/tag/188.8.131.5267] * Add SonarC# Plugin: 6.7 (This can be added manually to the Sonar Plugin folder) * Open in finder /usr/local/Cellar/sonarqube/6.7/libexec/extensions/plugins * Paste the plugin * Restart sonar in terminal -> sonar restart 7. Create a Login Token In Sonar. * Go to sonar portal in local machine -> http://localhost:9000/ * Login * Go to administration -> Security -> create new token-> Copy the token. 8. Analyse Source Code. * Go the source code root folder, the folder that has the project file that you want to build. * Run the below commands 1. mono /<PATH TO THE MSBUILD_FOR_SONAR_LOCATION>/sonar-scanner-msbuild-184.108.40.2061/MSBuild.SonarQube.Runner.exe begin /k:"COM.YOGI.AWESOME.APP" /n:"APP NAME" /v:"1.0" /d:sonar.login="TOKEN THAT YOU HAVE COPIED IN STEP 8" 2. MSbuild /t:rebuild 3. mono /<PATH TO THE MSBUILD_FOR_SONAR_LOCATION>//sonar-scanner-msbuild-220.127.116.111/MSBuild.SonarQube.Runner.exe end 9. Once Success You can find the report in Sonar. 10. Login to SonarQube as in Step 4. Report should be available