Creating a build that is capable of perform a SonarQube analysis on a VSTS / TFS is a really simple task, thanks to the two tasks that are present out-of-the box.
Figure 1: Build that uses Sonarqube tasks to perform analysis
The problem in a project that was alive for more than a couple of years is that you usually have a really bad report when you do your first analysis. This happens because, without a constant analysis, the code have surely some smells.
Sometimes you get really discouraged, because the number of issue is really high, but before losing any hope, check if the errors are really part of your code. In a project where I’m working, we got really bad numbers and I was 100% sure that it is not a problem of our code.
When you analyze your project for the first time, sometimes the number of issue is so high that you really are discouraged. Before giving up, check if the errors are really part of your code.
To diagnostic the problem, simply login to the project, then go to Code view (something like http://build:9000/code/?id=projectName), then you will see a summary of all the bugs, but unfortunately you cannot order for the number of the bug, so Just scroll down to see the part of the code with the most errors.
Figure 2: 185 bugs are located in scripts folder
Figure 3: Exclude folder for analysis