SonarAPIImplHints
This page just summarizes my quick play with Sonar web service API, for details see http://www.sonarsource.org and http://docs.codehaus.org/display/SONAR/Web+Service+API. List of queries which would be interesting for Maven IDE support and Sonar interaction follows:
- Get all sub-resources for some artifact (just to learn what res are available)
- <sonar_server>/api/resources?resource=<groupId>:<artifactId>&depth=-1, example: http://nemo.sonarsource.org/api/resources?resource=org.apache.wicket:wicket-parent&depth=-1
- Get all violations for java source file:
- <sonar_server>/api/violations?resource=<groupId>:<artifactId>:<class_name>, example: http://nemo.sonarsource.org/api/violations?resource=org.apache.wicket:wicket-examples:org.apache.wicket.examples.ajax.builtin.modal.ModalWindowPage
- Get violations of some type and priority for java source file:
- <sonar_server>/api/violations?resource=<groupId>:<artifactId>:<class_name>&categories=<Usability,Maintainability,Reliability,Efficiency,Portability>&priorities=<BLOCKER,CRITICAL,MAJOR,MINOR,INFO>, example: http://nemo.sonarsource.org/api/violations?resource=org.apache.wicket:wicket-examples:org.apache.wicket.examples.ajax.builtin.modal.ModalWindowPage&categories=Usability&priorities=BLOCKER,CRITICAL,MAJOR
- List rules of specific plugin:
- List of unit test files with count of failed tests for project (openejb here):
- example1: http://nemo.sonarsource.org/api/resources?resource=org.apache.openejb:openejb&metrics=test_errors,test_failures&scopes=FIL&qualifiers=UTS&depth=-1
- Unfortunately, I didn't find out how to retrieve stack traces from failed tests, I guess it's not possible with current Sonar API (Sep 24, 2009)

