Measurement and determination of the code quality is an eternal theme in the programming world. All the experts who already have experience with large projects with a long history do not doubt about the need to maintain the code in good quality. But there is not always enough time to find out what characteristics and metrics are important in this project. However, it appears in most of the cases cases that it is enough manage the following characteristics:
- compliance with the rules;
- the complexity of the code;
- duplicates;
- commenting;
- covering tests.
And there is a great tool to do all the stuff – Sonarqube. Below is a simple guide how to install this tool onto your local server.
-
- Download and extract SonarQube, SonarQube runner and the examples.
- Download java if you need to (search for java first).a. If you downloaded java 8 it will be in this directory: C:\Program Files (x86)\Java\jre1.8.0_31\bin
- Amend the wrapper.conf file (in the conf dir):From: wrapper.java.command=/path/to/my/jdk/bin/java
To: wrapper.java.command=C:\Program Files (x86)\Java\jre7\bin\java
or
To: wrapper.java.command=C:\Program Files (x86)\Java\jre1.8.0_31\bin\java
Note: Default is now wrapper.java.command=java so if java is in the PATH no need to edit this file - cd to sonar bin/windows-x86-32 directory and run StartSonar.bat
Note: There is now a bin/windows-x86-64 directory, this works with windows server 2012 - Test server by going to http://localhost:9000, there should be a blank SonarQube page.
- Go to the settings page on SonarQube, may need to log in (default is admin/admin)
- Click on the update center (left hand side of the screen)
- Click on available plugins and add c#, javascript and dotnet.
- Stop and restart the SonarQube server
- Configure the settings by clicking on “General Settings”.
- Setup .Net FxCop by clicking on .Net FxCop and changing the install directory to C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop
About The Author: Yotec Team
More posts by Yotec Team