Querying the CMetrics Issue Summary
Function
This API is used to query the CMetrics issue summary based on the check task ID.
Calling Method
For details, see Calling APIs.
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 |
It 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. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
task_id |
String |
Task ID. |
task_name |
String |
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 execution time. |
check_type |
String |
Check type. |
created_at |
String |
Creation time. |
metric_info |
MetricInfo object |
Metrics. |
Parameter |
Type |
Description |
---|---|---|
code_size |
String |
Code size. |
raw_lines |
String |
Total lines. |
methods_total |
String |
Total functions. |
cyclomatic_complexity_total |
String |
Total cyclomatic complexity. |
cyclomatic_complexity_per_method |
String |
Average cyclomatic complexity. |
maximum_cyclomatic_complexity |
String |
Maximum cyclomatic complexity. |
huge_cyclomatic_complexity_total |
String |
Huge cyclomatic complexity functions. |
huge_cyclomatic_complexity_ratio |
String |
Ratio of huge cyclomatic complexity functions. |
cca_cyclomatic_complexity_total |
String |
Total CCA cyclomatic complexity. |
cca_cyclomatic_complexity_per_method |
String |
Average CCA cyclomatic complexity. |
maximum_cca_cyclomatic_complexity |
String |
Maximum CCA cyclomatic complexity. |
huge_cca_cyclomatic_complexity_total |
String |
Number of huge CCA cyclomatic complexity functions. |
cyclomatic_complexity_adequacy |
String |
Cyclomatic complexity adequacy. |
maximum_depth |
String |
Maximum depth. |
huge_depth_total |
String |
Number of huge depths. |
huge_depth_ratio |
String |
Ratio of huge depths. |
method_lines |
String |
Number of lines containing functions. |
lines_per_method |
String |
Average code lines containing functions. |
huge_method_total |
String |
Number of huge functions. |
huge_method_ratio |
String |
Ratio of huge functions. |
files_total |
String |
Total files. |
folders_total |
String |
Total directories. |
lines_per_file |
String |
Average code lines in a file. |
huge_headerfile_total |
String |
Huge header files. |
huge_headerfile_ratio |
String |
Ratio of huge header files. |
huge_non_headerfile_total |
String |
Huge source files. |
huge_non_headerfile_ratio |
String |
Ratio of huge source files. |
huge_folder_total |
String |
Huge directories. |
huge_folder_ratio |
String |
Ratio of huge source directories. |
file_duplication_total |
String |
Duplicate files. |
file_duplication_ratio |
String |
File duplication rate. |
non_hfile_duplication_total |
String |
Duplicate source files. |
non_hfile_duplication_ratio |
String |
Source file duplication rate. |
code_duplication_total |
String |
Duplicate code. |
code_duplication_ratio |
String |
Code duplication rate. |
non_hfile_code_duplication_total |
String |
Duplicate source files. |
non_hfile_code_duplication_ratio |
String |
Source file code duplication rate. |
unsafe_functions_total |
String |
Unsafe functions. |
unsafe_functions_kloc |
String |
Density of unsafe functions. |
redundant_code_total |
String |
Redundant code. |
redundant_code_kloc |
String |
Density of redundant code blocks. |
warning_suppression_total |
String |
Suppressed alarms. |
warning_suppression_kloc |
String |
Density of suppressed alarms. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
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" : "Network busy. Try again later." }
Status code: 401
Unauthorized
{ "error_code" : "CC.00000003", "error_msg" : "Authentication information 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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot