Skip to end of metadata
Go to start of metadata
Note for Sonar newbies

This page describes how to launch a Sonar analysis on your desktop, using a command-line. This is handy to test Sonar and make sure everything works as expected.
However, it's best to also install Sonar on a dedicated server along with tools like Jenkins and its Jenkins Sonar Plugin so that analysis occurs in a continuous way without requiring human interaction.

Best practices and guidelines to know
  • As you've already read in the requirements, your solution must be compiled before running a Sonar analysis. However, please note that Sonar's primary goal is to analyse source code, so everything has been made to work seamlessly right after the compilation of a solution and before any packaging made by a build process. In other words, if you have build processes that move the compiled DLL or executables and package your application, it is definitely best to run Sonar before those steps (or in a separate process) otherwise you may run into troubles with over-complicated configuration of the C# plugins.
  • It is best to run the analysis from within the folder that contains the SLN file, in order to simplify the configuration of the C# plugins (e.g.: in such case, you do not need to tell where to find the SLN file).

 

Launch the analysis

Here's the way to launch a Sonar analysis:

  1. open a command prompt
  2. change to the directory that contains your Sonar configuration file (if you've followed our advice, this should be the root folder of your .NET solution)
  3. depending on the runner you chose, run the following command:

For the Simple Java Runner

For Maven

Check the results

Once the process is over, you will be able to browse the results in Sonar Web UI.

Check "Sonar in a nutshell" to know more about how to navigate in Sonar.

Labels
  • None