我能够使用以下 java 代码从 Sonar REST API 获取项目(资源)列表
Sonar sonar = Sonar.create("wwww.example.com/sonar/api/resources?metrics=nloc");
ResourceQuery query = new ResourceQuery();
List resourceList = sonar.findAll(query);
for(Resource resource : resourceList){
System.out.println(resource.getid()+":"+resource.getMetricIntValue("nloc"));
}
但这导致了
1001:null
1002:null
1003:null
1004:null
为什么代码行值返回空值?
最佳答案
docs显示值为 ncloc
而不是 nloc
的 metrics
参数。我认为您只是打错了字。
关于web-services - 如何在 Sonar REST api 中获取特定指标的所有值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23611274/