使用 rest 检查声纳项目的代码覆盖率 api
Check the code coverage for a project on sonar with rest api
声纳版本:5.3
我正在打这个电话
https://mysonar/api/resources/index?metrics=coverage&key=test-project
但是,我没有从这个电话中获得测试项目的覆盖范围。
但我正在获取其余项目及其覆盖范围。
当我这样做时
https://sonaraws.kdc.capitalone.com/api/resources/index
我可以在 api 响应中看到我的测试项目。
如何向下钻取到特定项目而不检查来自对 Sonar 的其余调用的其他项目。
api/resources
不支持 key
参数。您必须使用 qualifiers
和 resource
参数指定项目 ID。
这应该适合你:
https://mysonar/api/resources/index?metrics=coverage&qualifiers=TRK&resource=test-project
qualifiers
参数的可用值:
- 大众:观点
- 上海大众:子视图
- TRK:项目
- BRC: 模块
- UTS:单元测试
- DIR:目录
- FIL: 文件
- DEV:开发者
我正在使用下面的 api 来获取报道。 Sonarqube 版本 - 6.7.5
使用下面列出的第一个 api 获取项目的 componentId。
https://sonarurl/api/components/show?key=ProjectKey
https://sonarurl/api/measures/component?componentId=Ahvhjvds87373&metricKeys=coverage
回应
{
"component": {
"id": "Ahvhjvds87373",
"key": "ProjectKey",
"name": "ProjectName",
"qualifier": "TRK",
"measures": [{
"metric": "coverage",
"value": "79.3",
"periods": [{
"index": 1,
"value": "0.0"
}]
}]
}
}
声纳版本:5.3
我正在打这个电话
https://mysonar/api/resources/index?metrics=coverage&key=test-project
但是,我没有从这个电话中获得测试项目的覆盖范围。 但我正在获取其余项目及其覆盖范围。 当我这样做时
https://sonaraws.kdc.capitalone.com/api/resources/index
我可以在 api 响应中看到我的测试项目。
如何向下钻取到特定项目而不检查来自对 Sonar 的其余调用的其他项目。
api/resources
不支持 key
参数。您必须使用 qualifiers
和 resource
参数指定项目 ID。
这应该适合你:
https://mysonar/api/resources/index?metrics=coverage&qualifiers=TRK&resource=test-project
qualifiers
参数的可用值:
- 大众:观点
- 上海大众:子视图
- TRK:项目
- BRC: 模块
- UTS:单元测试
- DIR:目录
- FIL: 文件
- DEV:开发者
我正在使用下面的 api 来获取报道。 Sonarqube 版本 - 6.7.5
使用下面列出的第一个 api 获取项目的 componentId。
https://sonarurl/api/components/show?key=ProjectKey
https://sonarurl/api/measures/component?componentId=Ahvhjvds87373&metricKeys=coverage
回应
{
"component": {
"id": "Ahvhjvds87373",
"key": "ProjectKey",
"name": "ProjectName",
"qualifier": "TRK",
"measures": [{
"metric": "coverage",
"value": "79.3",
"periods": [{
"index": 1,
"value": "0.0"
}]
}]
}
}