Jump to: navigation, search

Difference between revisions of "Sonar"

(New page: == About code quality analysis == === Why? === Code quality analysis helps you to make your code: * less error-prone * more sustainable * more reliable * more readable * more welcoming t...)
 
(About Sonar)
(One intermediate revision by the same user not shown)
Line 19: Line 19:
  
 
[http://www.sonarsource.org/ Sonar] is an open-source product which is used to gather several metrics about code quality, put them all in a single dashboard, and provide some tips to help you making your code better, more sustainable, more reliable, less bugged.
 
[http://www.sonarsource.org/ Sonar] is an open-source product which is used to gather several metrics about code quality, put them all in a single dashboard, and provide some tips to help you making your code better, more sustainable, more reliable, less bugged.
 +
 +
Enable Hudson Sonar plugin on your job or running <tt>mvn sonar:sonar</tt> on your Maven build will result in the following flow of actions:
 +
# Sonar will locally analyze code and generate reports from many analyzers
 +
# Sonar will push those reports to the Sonar dashboard
  
 
== Sonar for Eclipse.org ==
 
== Sonar for Eclipse.org ==
Line 28: Line 32:
 
=== Enable Sonar for your project ===
 
=== Enable Sonar for your project ===
  
See http://mickaelistria.wordpress.com/2012/10/08/sonar-at-eclipse-org/ . You'll need a Tycho-based build, and a Job on [[Hudson]] sandbox to be able to push reports to Sonar
+
See http://mickaelistria.wordpress.com/2012/10/08/sonar-at-eclipse-org/ . You'll need a Tycho-based build, and a Job on [[Hudson]] sandbox to be able to push reports to Sonar.
 +
 
 +
=== Permissions on Sonar ===
 +
 
 +
Sonar is currently (and will remain) public to all, but only an admin can log it. So it's not yet possible to store user preferences or be made an administrator on a project. Follow bug [https://bugs.eclipse.org/bugs/show_bug.cgi?id=391343 391343] for more details.
  
 
=== Infrastructure ===
 
=== Infrastructure ===

Revision as of 11:57, 6 May 2013

About code quality analysis

Why?

Code quality analysis helps you to make your code:

  • less error-prone
  • more sustainable
  • more reliable
  • more readable
  • more welcoming to new contributors

How?

Code quality analysis mainly relies on a set of tools that look at your code and give you hints. The most famous tools are Findbugs, PMD, Checkstyle; but also code coverage tools such as Jacoco. JDT itself provides very powerful quality checks, but there are not enabled by default. You should go to Error/Warnings in preferences and replace all "ignore" by "Warning". You can (and should) enable such tools in IDE.

Code quality can also be analyzed out of the IDE, running those tools and using their reports to find out the "hot spots" in your code.

About Sonar

Sonar is an open-source product which is used to gather several metrics about code quality, put them all in a single dashboard, and provide some tips to help you making your code better, more sustainable, more reliable, less bugged.

Enable Hudson Sonar plugin on your job or running mvn sonar:sonar on your Maven build will result in the following flow of actions:

  1. Sonar will locally analyze code and generate reports from many analyzers
  2. Sonar will push those reports to the Sonar dashboard

Sonar for Eclipse.org

Usage

Sonar can be found on https://dev.eclipse.org/sonar . Several projects already have quality reports enabled. You can drill-down on code to see Sonar annotations on each class, or navigate through the different widget on dashboard to focus on dedicated issues

Enable Sonar for your project

See http://mickaelistria.wordpress.com/2012/10/08/sonar-at-eclipse-org/ . You'll need a Tycho-based build, and a Job on Hudson sandbox to be able to push reports to Sonar.

Permissions on Sonar

Sonar is currently (and will remain) public to all, but only an admin can log it. So it's not yet possible to store user preferences or be made an administrator on a project. Follow bug 391343 for more details.

Infrastructure

Sonar is installed on a VM. It uses its embedded Jetty server to publish to HTTP, and uses a PostgreSQL database on the same VM.

The database is made accessible from Eclipse.org servers and has a user for Sonar, and another user for Hudson. When running the Hudson Sonar plugin, the plugin uses this user to push to the Sonar database the metrics about your project.