Domanda

I've been trying Sonar's Web Service API and so far it seems to offer a lot of information. However, looks like working on a per developer level is not easy - or supported.

For instance, there are two things I'd like to fetch:

  • A list of the developers of a project. I know that using qualifiers=DEV I can get a list of all the developers in the system (sample request), but can't filter by project.
  • Filter metrics by developer and project. For instance, get the cyclomatic complexity of the code of developer D1 in project P1. How'd I do that? Is it even possible?
È stato utile?

Soluzione

You can get measures of a developer for a specific project with the following API call:

http://nemo.sonarsource.org/api/resources?resource=DEV:Fabrice%20Bellingard:org.codehaus.sonar:sonar&metrics=ncloc,coverage

The resource key is composite and consists of:

  • "DEV:"
  • the user name
  • ":"
  • the project key

Note that not all the metrics are computed on developers. For instance, you won't be able to have the complexity for the moment. You can see which metrics are computed when you go on a developer dashboard: for instance, the API call above gives metrics about me on Sonar.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top