addressbook-level4 icon indicating copy to clipboard operation
addressbook-level4 copied to clipboard

Explore sonarcube for code quality reporting

Open damithc opened this issue 8 years ago • 5 comments

Currently we are using codacy. Explore using sonarcube instead.

damithc avatar Jan 31 '17 04:01 damithc

Hello Prof. Damith,

Codacy staff, Rita, apologised for the incorrect information regarding checkstyle image and she will be creating an internal ticket to see if they can start detecting configurations in other locations.

I have also explore using SonarQube for a short period, using travis integration and SonarQube online, it seems like travis integration and online does not support checkstyle. Will be trying out using SonarQube server next and keep you updated on the progress.

eugenepeh avatar Feb 02 '17 03:02 eugenepeh

Thanks for the update @eugenepeh Keep us posted.

damithc avatar Feb 02 '17 06:02 damithc

Experience so far using SonarQube

Does not detect checkstyle.xml in project folder

When SonarQube was maintaining the Sonar checkstyle plugin, they did not implement this feature according to checkstyle contributor Source : http://stackoverflow.com/questions/17819721/how-to-use-existing-checkstyle-files-in-sonarqube Also ever since the Checkstyle team takes over Sonar Checkstyle Plugin project from Sonar (about 2 months ago), they have not yet implement this feature either (from their release notes), not sure if it will be implemented in future Source : https://github.com/checkstyle/sonar-checkstyle

To use our own checkstyle.xml, user has to import it into sonar server, however it seems not every rule is available yet I encountered the (below) error/problem when attempt to upload addressbook's checkstyle into the server. image

Quick setup for SonarQube

If anyone would like to try out using SonarQube,

Below are 2 quick guides to setting up SonarQube server and checkstyle plugin for SonarQube

  • https://docs.sonarqube.org/display/SONAR/Get+Started+in+Two+Minutes
  • https://github.com/checkstyle/sonar-checkstyle

You will also need to have the sonar-project.properties file in your project root,

  • Copy the one in this guide https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

To run a scan

  • Start running your SonarQube server by going to your [SONARQUBE_LOCATION] -> bin -> [YOUR_RUNNING_PLATFORM] -> StartSonar.bat
  • Open command prompt, cd to your project folder root, type "[YOUR_SONAR_RUNNER_LOCATION]\bin\sonar-runner"

Result will be in your http://localhost:9000 or the link of your command prompt if its different

If you encounter problem starting sonar server, terminate java.exe and re-try again.

default login for localhost server user : admin password : admin

eugenepeh avatar Feb 05 '17 15:02 eugenepeh

Hello Prof. Damith @damithc ,

The codacy issue, unable to detect checkstyle config file in any other places except project root, has been resolved and I has verified that it is working properly now too. image

eugenepeh avatar Feb 18 '17 10:02 eugenepeh

Thanks for the update @eugenepeh Good to hear that codacy issue is fixed. Unfortunately, I'm not sure we can rely on codacy entirely because they have introduced a 10 PR analysis per day restriction on free accounts. 10 might be enough for a project like addressbook but I wish we had a codacy-like tool we can use to comment on PRs created by CS2103 students for tutorials.

damithc avatar Feb 18 '17 15:02 damithc