[MR Widget Eng] Code Quality - v2 - Use dedicated API endpoint for collapsed/uncollapsed state
This is a follow up Issue from !82113 (merged)
The current Implementation of the Code Quality MR Widget is using only one endpoint on page load, in the future we should optimize this to use one endpoint for the collapsed another one for the uncollapsed state.
Demo Screen shot |
---|
![]() |
current state of the endpoint
URL: https://gitlab.com/USERl/
PROJECT/-/merge_requests/15/codequality_reports.json example link
response:
{
"status": "failed",
"new_errors": [
{
"description": "Remove this unused method parameter \"a\".",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
},
{
"description": "Method has 9 parameters, which is greater than 7 authorized.",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
}
],
"resolved_errors": [
{
"description": "Remove this unused method parameter \"a\".",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
},
{
"description": "Method has 8 parameters, which is greater than 7 authorized.",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
}
],
"existing_errors": [
{
"description": "Replace this use of System.out or System.err by a logger.",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 3
},
{
"description": "Replace this use of System.out or System.err by a logger.",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 8
}
],
"summary": {
"total": 5,
"resolved": 2,
"errored": 5
}
}
future state of the endpoints:
URL: https://gitlab.com/USERl/
PROJECT/-/merge_requests/15/codequality_reports_summary.json
response:
{
"resolved_errors": integer
"new_errors": integer
}
URL: https://gitlab.com/USERl/
PROJECT/-/merge_requests/15/codequality_reports.json
response:
{
"new_errors": [
{
"description": "Remove this unused method parameter \"a\".",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
},
{
"description": "Method has 9 parameters, which is greater than 7 authorized.",
"severity": "major",
"file_path": "HelloWorld.java",
"line": 6
}
],
"resolved_errors": [],
"existing_errors": [],
}
UPDATE: This Issue is blocked by: #387293 We should remove the unused values in the response before we start to optimize for performance. The above data examples WILL BE AFFECTED by fixing the blocking Issues.
While it remains a noble cause to the introduce another endpoint for the collapsed state. We must only do this if we can ensure that we are capable of making the collapsed endpoint faster in response then the endpoint to fetch the full data. If we can not assure this we should close this issue as won't do because we'd be adding complexity without any benefit.
Implementation Plan (Draft)
- Create new backend endpoint to provide CodeQuality Summary report (see json above)
- Adjust CodeQuality MR Widget Extension to not compute summary from full report but fetch collapsed endpoint and render summary and only fetch full report when MR Widget is uncollapsed.