查询cmetrics缺陷概要
功能介绍
根据检查任务ID查询cmetrics缺陷概要。
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/tasks/{task_id}/metrics-summary
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,每个CodeArts首页下的项目都有1个唯一的项目ID |
task_id |
是 |
String |
任务ID,即新建检查任务接口的返回值,每个CodeArtsCheck任务及其下的分支任务、通过API创建的增量任务都有1个唯一的任务ID |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
task_id |
String |
任务id |
task_name |
String |
任务名字 |
creator_id |
String |
创建者id |
git_url |
String |
代码仓地址 |
git_branch |
String |
代码仓分支 |
last_check_time |
String |
上一次检查时间 |
last_exec_time |
String |
上次执行时间 |
check_type |
String |
检查类型 |
created_at |
String |
创建时间 |
metric_info |
MetricInfo object |
度量项 |
参数 |
参数类型 |
描述 |
---|---|---|
code_size |
String |
代码规模 |
raw_lines |
String |
原始代码行数 |
methods_total |
String |
函数总数 |
cyclomatic_complexity_total |
String |
圈复杂度总数 |
cyclomatic_complexity_per_method |
String |
平均圈复杂度 |
maximum_cyclomatic_complexity |
String |
最大圈复杂度 |
huge_cyclomatic_complexity_total |
String |
超大圈复杂度函数总数 |
huge_cyclomatic_complexity_ratio |
String |
超大圈复杂度比例 |
cca_cyclomatic_complexity_total |
String |
cca圈复杂度总数 |
cca_cyclomatic_complexity_per_method |
String |
cca平均圈复杂度 |
maximum_cca_cyclomatic_complexity |
String |
cca最大圈复杂度 |
huge_cca_cyclomatic_complexity_total |
String |
超大cca圈复杂度函数总数 |
cyclomatic_complexity_adequacy |
String |
圈复杂度满足度 |
maximum_depth |
String |
最大深度 |
huge_depth_total |
String |
超大深度数 |
huge_depth_ratio |
String |
超大深度占比 |
method_lines |
String |
函数总行数 |
lines_per_method |
String |
函数平均代码行 |
huge_method_total |
String |
超大函数数 |
huge_method_ratio |
String |
超大函数占比 |
files_total |
String |
文件总数 |
folders_total |
String |
目录总数 |
lines_per_file |
String |
文件平均代码行 |
huge_headerfile_total |
String |
超大头文件数 |
huge_headerfile_ratio |
String |
超大头文件占比 |
huge_non_headerfile_total |
String |
超大源文件数 |
huge_non_headerfile_ratio |
String |
超大源文件占比 |
huge_folder_total |
String |
超大目录数 |
huge_folder_ratio |
String |
超大目录占比 |
file_duplication_total |
String |
重复文件数 |
file_duplication_ratio |
String |
文件重复率 |
non_hfile_duplication_total |
String |
重复源文件数 |
non_hfile_duplication_ratio |
String |
源文件重复率 |
code_duplication_total |
String |
代码重复数 |
code_duplication_ratio |
String |
代码重复率 |
non_hfile_code_duplication_total |
String |
源文件代码重复数 |
non_hfile_code_duplication_ratio |
String |
源文件代码重复率 |
unsafe_functions_total |
String |
危险函数总数 |
unsafe_functions_kloc |
String |
危险函数密度 |
redundant_code_total |
String |
冗余代码数 |
redundant_code_kloc |
String |
冗余代码块密度 |
warning_suppression_total |
String |
抑制告警数 |
warning_suppression_kloc |
String |
抑制告警密度 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码: 401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
请求示例
GET https://{endpoint}/v2/{project_id}/tasks/{task_id}/metrics-summary
响应示例
状态码: 200
Request succeeded!
{
"task_id" : "435b58ecf7f54c45907c1384d01c94a6",
"task_name" : "CSharp_02201119",
"creator_id" : "ecadebb5041146cc96f9780f3d905e20",
"git_url" : "git@****_02201119.git",
"git_branch" : "master",
"last_check_time" : "2020-02-20 11:37:46",
"last_exec_time" : "2020-02-20 11:37:46",
"check_type" : "source",
"created_at" : "2020-02-20 11:21:11",
"metric_info" : {
"code_size" : "133426.00",
"raw_lines" : "182082.00",
"methods_total" : "6840.00",
"cyclomatic_complexity_total" : "27435.00",
"cyclomatic_complexity_per_method" : "7.43",
"maximum_cyclomatic_complexity" : "346.00",
"huge_cyclomatic_complexity_total" : "167.00",
"huge_cyclomatic_complexity_ratio" : "4.13",
"cca_cyclomatic_complexity_total" : "26693.00",
"cca_cyclomatic_complexity_per_method" : "7.25",
"maximum_cca_cyclomatic_complexity" : "342.00",
"huge_cca_cyclomatic_complexity_total" : "148.00",
"cyclomatic_complexity_adequacy" : "21.00",
"maximum_depth" : "333.00",
"huge_depth_total" : "8.85",
"huge_depth_ratio" : "91546.00",
"method_lines" : "24.91",
"lines_per_method" : "8.04",
"huge_method_total" : "12300",
"huge_method_ratio" : "12300",
"files_total" : "629.00",
"folders_total" : "426.00",
"lines_per_file" : "12300",
"huge_headerfile_total" : "12300",
"huge_headerfile_ratio" : "12300",
"huge_non_headerfile_total" : "12300",
"huge_non_headerfile_ratio" : "12300",
"huge_folder_total" : "12300",
"huge_folder_ratio" : "12300",
"file_duplication_total" : "12300",
"file_duplication_ratio" : "12300",
"non_hfile_duplication_total" : "12300",
"non_hfile_duplication_ratio" : "12300",
"code_duplication_total" : "3.28",
"code_duplication_ratio" : "11782.00",
"non_hfile_code_duplication_total" : "8.59",
"non_hfile_code_duplication_ratio" : "11782.00",
"unsafe_functions_total" : "17.17",
"unsafe_functions_kloc" : "0.00",
"redundant_code_total" : "0.00",
"redundant_code_kloc" : "674.00",
"warning_suppression_total" : "17.00",
"warning_suppression_kloc" : "0.45"
}
}
状态码: 400
Bad Request
{
"error_code" : "CC.00000000",
"error_msg" : "网络繁忙,请稍后再试"
}
状态码: 401
Unauthorized
{
"error_code" : "CC.00000003",
"error_msg" : "认证信息过期"
}
状态码
状态码 |
描述 |
---|---|
200 |
Request succeeded! |
400 |
Bad Request |
401 |
Unauthorized |
错误码
请参见错误码。