SonarQube is all in one code quality tool, it covers following main aspects of code quality
2) Code coverage
3) Potential bugs
4) Architecture and Design
It is easy to use and configurable as per your need, SonarQube reuses the tools like FindBug, PMD, Cobertura, JUnits etc. Sonar also supports multiple languages. You can configure your own rules, rules can be configured project specific. You can integrate Sonar with Jenkins, so once your project is built all required rules will be analysed and published on SonarQube.
This is a quick start tutorial to setup a SonarQube.
You need JRE 6 or above to run the 4.5 SonarQube distribution.
Download the SonarQube distribution from the site, I used 4.5 version. Download from SonarQube 4.5
Extract the content of the file to a folder.
I used MySQL as backend to store the analysis data. to configure MySQL, run following queries on MySQL
CREATE DATABASE SonarDBName CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'sonar' IDENTIFIED BY 'sonar'; GRANT ALL ON SonarDBName.* TO 'sonar'@'%' IDENTIFIED BY 'sonar'; GRANT ALL ON SonarDBName.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar'; FLUSH PRIVILEGES;
Change the SonarDBName to whatever you prefer, if you have your mySQL running on different server, change the value of ‘localhost’ to the specific host.
Configure Sonar to use MySQL as your default DB,Open the file conf/sonar.properties to edit, search for “sonar.jdbc.url”
In above snippet sonarQube is the Sonar DB name.
Now start your SonarQube /bin/windows-x86-32 (if you are running it on different platform, choose appropriate directory), in initial start up Sonar will download two plugins by default java and FindBug. if you need additional plugins you can download it from Sonar plugin site and copy it to /extensions/plugins. This is manual method.
I have used following plugins
Your default password for admin user is admin, login to the SonarQube instance by hitting localhost:9000 and change the default admin password, if required you can add more users and user groups. plugins also available to synch with Active Directory.