Updated on 2024-03-15 GMT+08:00

Query Defect Summary

Function

Query the summary of the defect result based on the check task ID. Including the problem overview, problem status, cyclomatic complexity, and code repetition rate.

Calling Method

For details, see Calling APIs.

URI

GET /v2/tasks/{task_id}/defects-summary

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Task ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Minimum: 1

Maximum: 100000

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

task_id

String

Task ID

task_name

String

Indicates the task name.

creator_id

String

Creator ID.

git_url

String

Code Repository Address

git_branch

String

Code repository branch. If the MR mode is used, the value is the source branch.

last_check_time

String

Last Check Time

code_line_total

Integer

Total Number of Code Lines

code_line

Integer

Number of Valid Code Lines

code_quality

Number

Code quality

issue_count

Integer

Number of Problems

risk_coefficient

Number

Dangerous Function

duplication_ratio

String

Repetition Ratio

complexity_count

Integer

Complexity

duplicated_lines

Integer

Duplicate Rows

comment_lines

Integer

Number of Comment Lines

comment_ratio

String

Comment Ratio

duplicated_blocks

Integer

Duplicate block

last_exec_time

String

Last Executed

check_type

String

Check type.

created_at

String

Time when the gateway response is created

cyclomatic_complexity_per_method

String

Average Code Complexity

cyclomatic_complexity_per_file

String

Average Code Complexity (File)

critical_count

String

Critical

major_count

String

Major

minor_count

String

Minor

suggestion_count

String

Suggestion

is_access

String

Check whether the access control quality is passed.

trigger_type

String

Task Triggering Mode

file_duplication_ratio

String

File repetition rate

new_count

Integer

Number of New Issues

solve_count

Integer

Resolved

duplicated_files

Integer

Number of duplicate files.

new_critical_count

String

Number of New Critical Defects

new_major_count

String

Number of New Major Problems

new_minor_count

String

Number of New Minor Problems

new_suggestion_count

String

Number of New Suggestion Issues

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Example Requests

GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-summary

Example Responses

Status code: 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",
  "code_line_total" : 20,
  "code_line" : 156,
  "code_quality" : 147.4,
  "issue_count" : 3,
  "risk_coefficient" : 23,
  "duplication_ratio" : "0.0%",
  "complexity_count" : 0,
  "duplicated_lines" : 0,
  "comment_lines" : 0,
  "comment_ratio" : "0",
  "duplicated_blocks" : 0,
  "last_exec_time" : "2 minutes 28 seconds",
  "check_type" : "source",
  "created_at" : "2020-02-20 11:21:11",
  "cyclomatic_complexity_per_method" : "84.0",
  "cyclomatic_complexity_per_file" : "112.0",
  "critical_count" : 2,
  "major_count" : 1,
  "minor_count" : 1,
  "suggestion_count" : 1,
  "is_access" : 0,
  "trigger_type" : 1,
  "file_duplication_ratio" : "33.3%",
  "new_count" : 0,
  "solve_count" : 0,
  "duplicated_files" : 0,
  "new_critical_count" : "0",
  "new_major_count" : "0",
  "new_minor_count" : "0",
  "new_suggestion_count" : "0"
}

Status code: 400

Bad Request

{
  "error_code" : "CC.00000000",
  "error_msg" : "The network is busy. Please try again later."
}

Status code: 401

Unauthorized

{
  "error_code" : "CC.00000003",
  "error_msg" : "The authentication information has expired."
}

Status Codes

Status Code

Description

200

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.