查询缺陷详情
功能介绍
根据检查任务ID分页查询缺陷结果详情。
调用方法
请参见如何调用API。
URI
GET /v2/tasks/{task_id}/defects-detail
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
task_id |
是 |
String |
任务ID,即新建检查任务接口的返回值,每个CodeArtsCheck任务及其下的分支任务、通过API创建的增量任务都有1个唯一的任务ID |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
offset |
否 |
Integer |
分页索引,非偏移量,从0开始,即该参数实际起page_num作用 |
limit |
否 |
Integer |
每页显示的数量,每页最多显示100条 |
status_ids |
否 |
String |
问题状态筛选,0待处理;1已解决+已修复;2已忽略。可使用字符','组合,默认为0 |
severity |
否 |
String |
严重级别,0致命;1严重;2一般;3提示。可使用字符','组合,默认全部查询 |
delay_status |
否 |
String |
筛选正式、延迟告警。值为0、1,可通过","组合,默认查询正式告警 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
defects |
Array of DefectInfoV2 objects |
缺陷详情信息 |
total |
Integer |
总数 |
参数 |
参数类型 |
描述 |
---|---|---|
defect_id |
String |
缺陷的id |
defect_checker_name |
String |
缺陷对应检查项的名称 |
defect_status |
String |
缺陷的状态0为解决 1已解决 2已忽略 |
rule_system_tags |
String |
规则标签,多个标签用逗号隔开 |
rule_id |
String |
规则id |
rule_name |
String |
规则名 |
line_number |
String |
缺陷所在文件行号 |
defect_content |
String |
缺陷描述 |
defect_level |
String |
缺陷等级,0致命,1严重,2一般,3提示 |
file_path |
String |
缺陷文件路径 |
created_at |
String |
创建时间 |
issue_key |
String |
问题唯一标识 |
fragment |
Array of DefectFragmentV2 objects |
缺陷代码片段详情 |
events |
Array of DefectEvents objects |
调用链信息 |
参数 |
参数类型 |
描述 |
---|---|---|
line_num |
String |
行号 |
line_content |
String |
该行代码内容 |
start_offset |
Integer |
缺陷开始列号 |
end_offset |
Integer |
缺陷结束列号 |
参数 |
参数类型 |
描述 |
---|---|---|
events |
Array of DefectEvents objects |
调用链信息 |
description |
String |
描述 |
fix_suggestions |
Array of strings |
修复建议 |
line |
Integer |
缺陷所在行 |
end_line |
Integer |
缺陷结束行 |
code_context_start_line |
Integer |
缺陷开始行 |
main |
Boolean |
代码片段 |
path |
String |
路径 |
tag |
String |
标签 |
main_buggy_code |
String |
主事件对应的代码片段 |
code_context |
String |
代码上下文 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码: 401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
请求示例
GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-summary
响应示例
状态码: 200
Request succeeded!
{ "defects" : [ { "line_number" : "81", "defect_id" : "5b71a4594bcb4a69a33f576c3564e6cc", "rule_system_tags" : "fossscan", "rule_id" : "111", "rule_name" : "FossScan.1 OpenSource Software", "defect_checker_name" : "Disallow fallthrough of `case` statements", "defect_status" : "0", "defect_content" : "Update or refactor this function so that its implementation doesn't duplicate the one on line 60.", "defect_level" : "1", "file_path" : "code/types/functions.ts", "created_at" : "2020-07-21T02:12:01Z", "issue_key" : "AA76E96XXXXXXXXXXXXXXXXXCAAE5", "fragment" : [ { "line_num" : "78", "line_content" : " export function padding(all: number);", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "79", "line_content" : " export function padding(topAndBottom: number, leftAndRight: number);", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "80", "line_content" : " export function padding(top: number, right: number, bottom: number, left: number);", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "81", "line_content" : " export function padding(a: number, b?: number, c?: number, d?: number) {", "start_offset" : 11, "end_offset" : 19 }, { "line_num" : "82", "line_content" : " if (b === undefined && c === undefined && d === undefined) {", "start_offset" : -1, "end_offset" : -1 } ] }, { "line_number" : "190", "defect_id" : "5b71a4594wtrfsgrew546t466c3564e6cc", "rule_system_tags" : "fossscan", "rule_id" : "112", "rule_name" : "FossScan.1 OpenSource Software", "defect_checker_name" : "Disallow fallthrough of `case` statements", "defect_status" : "0", "defect_content" : "Update or refactor this function so that its implementation doesn't duplicate the one on line 173.", "defect_level" : "1", "file_path" : "code/types/types.ts", "created_at" : "2020-07-21T02:12:01Z", "issue_key" : "AA76E96XXXXXXXXXXXXXXXXXFE3B6", "fragment" : [ { "line_num" : "187", "line_content" : " var _value;", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "188", "line_content" : " function getOrSet(): number;", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "189", "line_content" : " function getOrSet(value: number);", "start_offset" : -1, "end_offset" : -1 }, { "line_num" : "190", "line_content" : " \" function getOrSet(value?: number) {\"", "start_offset" : 4, "end_offset" : 12 }, { "line_num" : "191", "line_content" : " \" if (value === undefined) {\"", "start_offset" : -1, "end_offset" : -1 } ] } ], "total" : 2 }
状态码: 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 |
错误码
请参见错误码。