查询代码度量概要
功能介绍
根据检查任务ID查询代码度量概要
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/tasks/{task_id}/metrics-summary
| 
         参数  | 
       
         是否必选  | 
       
         参数类型  | 
       
         描述  | 
      
|---|---|---|---|
| 
         task_id  | 
       
         是  | 
       
         String  | 
       
         参数解释: 任务ID,即新建检查任务接口的返回值,每个CodeArtsCheck任务及其下的分支任务、通过API创建的增量任务都有1个唯一的任务ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。  | 
      
| 
         project_id  | 
       
         是  | 
       
         String  | 
       
         参数解释: 项目的32位uuid,项目唯一标识,通过查询项目列表接口查询项目列表获取。 约束限制: 不涉及。 取值范围: 32位项目ID。 默认取值: 不涉及。  | 
      
请求参数
| 
         参数  | 
       
         是否必选  | 
       
         参数类型  | 
       
         描述  | 
      
|---|---|---|---|
| 
         X-Auth-Token  | 
       
         是  | 
       
         String  | 
       
         参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 不涉及。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。  | 
      
响应参数
状态码:200
| 
         参数  | 
       
         参数类型  | 
       
         描述  | 
      
|---|---|---|
| 
         task_id  | 
       
         String  | 
       
         参数解释: 任务ID,即新建检查任务接口的返回值,每个CodeArtsCheck任务及其下的分支任务、通过API创建的增量任务都有1个唯一的任务ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。  | 
      
| 
         task_name  | 
       
         String  | 
       
         参数解释: 任务名称。 取值范围: 不涉及。  | 
      
| 
         creator_id  | 
       
         String  | 
       
         参数解释: 任务创建者用户ID。 取值范围: 不涉及。  | 
      
| 
         git_url  | 
       
         String  | 
       
         参数解释: 代码仓地址。 取值范围: 不涉及。  | 
      
| 
         git_branch  | 
       
         String  | 
       
         参数解释: 代码仓分支。 取值范围: 不涉及。  | 
      
| 
         last_check_time  | 
       
         String  | 
       
         参数解释: 上一次检查时间。格式2025-07-21T03:38:53Z。 取值范围: 不涉及。  | 
      
| 
         last_exec_time  | 
       
         String  | 
       
         参数解释: 上一次检查时间。格式2025-07-21T03:38:53Z。 取值范围: 不涉及。  | 
      
| 
         last_check_finish_time  | 
       
         String  | 
       
         参数解释: 上次执行结束时间。格式2025-07-21T03:38:53Z。 取值范围: 不涉及。  | 
      
| 
         check_type  | 
       
         String  | 
       
         参数解释: 检查类型。 取值范围: 不涉及。  | 
      
| 
         created_at  | 
       
         String  | 
       
         参数解释: 任务创建时间。格式2025-07-21T03:38:53Z。 取值范围: 不涉及。  | 
      
| 
         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  | 
       
         错误描述  | 
      
请求示例
在ID为e04b357xxxxx5ed832xxxxxx的项目下,查询ID为2b31ed520xxxxxxebedb6e57xxxxxxxx的任务的代码度量概要
GET https://{endpoint}/v2/e04b357xxxxx5ed832xxxxxx/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/metrics-summary
null
  响应示例
状态码: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",
  "last_check_finish_time" : "2020-02-20 11:53: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  | 
      
错误码
请参见错误码。