Managing Code Debt in Team Foundation Server with SonarQube

Managing Code Debt in Team Foundation Server with SonarQube

SonarQube?is a popular open source platform for managing quality in the scope of an application life cycle. It covers the seven axes of quality around the source code, namely???code clones, unit testing, complexity, potential source of bugs, adherence to static rules, documentation in the form of comments, and architecture and design. The beauty of SonarQube is not only its ability to combine matrices for better correlation and analysis, but also to mix them with historical results. SonarQube is extensible using plugins and provides out-of-the-box support for multiple languages including C#. It also offers a plugin for MS Build, letting you integrate SonarQube with Team Build definitions in TFS and making code debt analysis part of your build definitions.

To configure SonarQube for TFS, first you can download SonarQube.

Next you can download the C# and MS Build plugins.

Note that you will need Java running on your system to configure and run SonarQube.

Extract the downloaded package to a local folder in your system and place the C# plugin jar file under the extensionsplugins?directory. Run the StartSonar.bat?file in the bin?folder to start the SonarQube server. SonarQube by default runs on the 9000 port. Once the server is started you can navigate to the http://localhost:9000 url to access the SonarQube portal.

Next extract the MS Build plugin package to a local folder and verify that the sonar.host.url?property in the SonarQube.Analysis.xml?file has the correct SonarQube server address configured.

You are now ready to configure SonarQube analysis with your TFS Team build definition. Modify your team build definition to set the Pre-build script path?under advance properties to the full path to MSBuild.SonarQube.Runner.exe?file. Also set the Pre-build script arguments?to contain the following four arguments:

  • begin
  • /k: [the project key of the SonarQube project]
  • /n: [the project name]
  • /v: [the project version]

Also set the Post-test script path?to the full path to MSBuild.SonarQube.Runner.exe, and the Post-test script arguments?to contain the argument “end“.

You are all set. Once you run the build, in the build report you will see the SonarQube analysis summary and a link to see the analysis results that will direct you to the dashboard.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as