Monday 20 February 2017

SonarQube Extension for VSTS/TFS

In the post Setup SonarQube Analysis with TFS Builds usage of Sonar Server with TFS build to measure quality of code is explained. The task catalogue tasks explained in the post Setup SonarQube Analysis with TFS Builds are now deprecated. There is an extension available in marketplace for SonarQube. This extension provide new begin analysis and end analysis tasks to be used in a TFS build.
Once you install the SonarQube extension for VSTS/TFS you can setup service endpoint type of SonarQube.
This endpoint requires a token as shown below. Server URL is the URL of your Sonar Server.image
To generate a token go to Sonar server and create a user named like ProjectFeeder (can be any name) with following sonar-users permissions. By default all users get create project and execute analysis permissions that is sufficient to execute analysis with TFS/VSTS builds..image
Logout from admin user and login with project feeder user to generate a token.On My Account of the Project Feeder user, in the security tab provide a name and generate a token. Then use that token in TFS/VSTS service endpoint.SNAGHTML3cdf60b
The extension makes new tasks available in task catalogue. SonarQube Scanner CLI allows to analyze PHP, JavaScript etc. projects. New Begin Analysis and End Analysis allows to use with .Net projects analyzing C#, JavaScript etc. as explained in Setup SonarQube Analysis with TFS Buildsimage
Once a build is setup sonar analysis and queued the build summary provides a link to the analysis results. Quality gate status is shown in the build summary.image
Link will take you to the Sonar Server details of the analysis. You can drill down each item in the Sonar Server dashboard.image

1 comment:

Unknown said...

When running "SonarQube Scanner CLI" vNext build task, I get "Path to tslint.json and tsconfig.json configuration files either not defined or not found" when trying to analyze typescript .ts files. How do you specify tslint.json? I tried specifying a Settings File SonarQube.Analysis.xml with sonar.ts.tslintconfigpath value in Advanced section of the task without success. We have TFS 2015 Update 3 and SonarQube 5.6.6 with SonarTS plugin. Thanks.

Popular Posts