在我的声纳上运行以下代码时,测量返回 null。(应该返回“1=author;2=author...”行)。但是它适用于 nemo.sonarsource.org。
其他措施,例如:违规对我的工作正常,所以这可能不是错误代码的问题。我怀疑我需要以某种方式配置声纳?
private final Sonar sonar;
public String getAuthors(String resourceKey){
return getMeasure(resourceKey, "authors_by_line").getData();
}
private Measure getMeasure(String resourceKey, String measureName){
Resource resource = sonar.find(ResourceQuery.createForMetrics(
resourceKey, measureName));
Measure measure = resource.getMeasure(measureName);
return measure;
}