Querying the cmertrics Defect Summary
Function
Query the cmertrics defect summary based on the check task ID.
URI
GET /v2/{project_id}/tasks/{task_id}/metrics-summary
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID |
task_id |
Yes |
String |
Task ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. Minimum: 1 Maximum: 100000 |
Response Parameters
Status code: 200
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 |
last_check_time |
String |
Last Check Time |
last_exec_time |
String |
Last Executed |
check_type |
String |
Check type. |
created_at |
String |
Created |
metric_info |
MetricInfo object |
Measurement Item |
Parameter |
Type |
Description |
---|---|---|
code_size |
String |
Code size |
raw_lines |
String |
Total Lines |
methods_total |
String |
Total number of functions |
cyclomatic_complexity_total |
String |
Total Cyclomatic Complexity |
cyclomatic_complexity_per_method |
String |
Average cyclomatic complexity: ≤ 5 |
maximum_cyclomatic_complexity |
String |
Maximum Cyclomatic Complexity |
huge_cyclomatic_complexity_total |
String |
Complexity of Ultra-Large Circles |
huge_cyclomatic_complexity_ratio |
String |
Ratio of ultra-large cyclomatic complexity |
cca_cyclomatic_complexity_total |
String |
Total number of cca cyclomatic complexity |
cca_cyclomatic_complexity_per_method |
String |
cca average cyclomatic complexity |
maximum_cca_cyclomatic_complexity |
String |
Maximum Cyclomatic Complexity of cca |
huge_cca_cyclomatic_complexity_total |
String |
Total Number of Functions with Ultra-Large Cyclomatic Complexity |
cyclomatic_complexity_adequacy |
String |
Cyclomatic Complexity Satisfaction |
maximum_depth |
String |
Maximum depth |
huge_depth_total |
String |
Number of ultra-large depths |
huge_depth_ratio |
String |
Percentage of Ultra-Large Depth |
method_lines |
String |
Total number of rows in a function |
lines_per_method |
String |
Average Code Lines of a Function |
huge_method_total |
String |
Number of oversized functions |
huge_method_ratio |
String |
Percentage of ultra-large functions |
files_total |
String |
Total Files |
folders_total |
String |
Total number of directories |
lines_per_file |
String |
Average Lines of Code in a File |
huge_headerfile_total |
String |
Number of oversized header files |
huge_headerfile_ratio |
String |
Percentage of Oversized Header Files |
huge_non_headerfile_total |
String |
Number of oversized source files |
huge_non_headerfile_ratio |
String |
Percentage of Oversized Source Files |
huge_folder_total |
String |
Number of ultra-large directories |
huge_folder_ratio |
String |
Percentage of Ultra-Large Directories |
file_duplication_total |
String |
Number of duplicate files |
file_duplication_ratio |
String |
File repetition rate |
non_hfile_duplication_total |
String |
Number of duplicate source files |
non_hfile_duplication_ratio |
String |
Source File Repetition Rate |
code_duplication_total |
String |
Number of repeated codes |
code_duplication_ratio |
String |
Duplication Rate |
non_hfile_code_duplication_total |
String |
Number of duplicate source file codes. |
non_hfile_code_duplication_ratio |
String |
Source File Code Repetition Rate |
unsafe_functions_total |
String |
Total Number of Dangerous Functions |
unsafe_functions_kloc |
String |
Density of Dangerous Functions |
redundant_code_total |
String |
Number of redundant codes |
redundant_code_kloc |
String |
Density of redundant code blocks |
warning_suppression_total |
String |
Number of suppressed alarms |
warning_suppression_kloc |
String |
Suppressed Alarm Density |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error Codes |
error_msg |
String |
Description |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error Codes |
error_msg |
String |
Description |
Example Requests
GET https://{endpoint}/v2/{project_id}/tasks/{task_id}/metrics-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", "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" } }
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.