Tuesday 3 October 2017

Setting Quality Profile via VSTS/TFS Build for SonarQube

Sonar analysis helps to identify the technical debt in the source code of your project. Running it integrated with VSTS or TFS builds add more value by automating the quality checks with sonar server. You can define your own custom Quality Profile to analyze your source code with selected set of rules. Let’s look at how you can specify the Quality Profile with the TFS/VSTS build task, that can be used to automate scanning of your code, when using the SonarQube extension in the visual studio marketplace.

You can set the parameter “sonar.profile” in the advance settings of the build task “Prepare the SonarQube analysis”.  (It is mentioned that this property is deprecated in https://jira.sonarsource.com/browse/SONAR-5370, but it still works and this property is an item that should not be deprecated is the opinion of many people commented there which is very much agreeable). The syntax that should be used to specify the property is as below.


This applies the profile in the scanning when the project is getting created for the first time in SonarQube as well.image

It is possible for you to specify a Quality Profile for a project that is already created and then without using this parameter. but this would be useful when handling these scans and projects in a more dynamic way, creating and removing projects from SonarQube dynamically if required.

No comments:

Popular Posts