[MR Widget Eng] prefix severity key with `severity` in codequality_reports.json to match GitLab Ui Naming schema
Note: The severity was concluded as being redundant. Relevant discussion: !102178 (comment 1170649674)
This is a follow up Issue from !82113 (comment 872133319)
The current Implementation of the codequality_reports.json
has a field called severity
.
This field is being used for multiple things, as plain text to render to the UI and to be processed to be an icon key in the FE.
It would be great if we could eliminate this Icon-naming processing on the clientside and add this field to the BE response. We should do this for both the json response as well as the GraphQL response.
The current mapping between the severity and the relevant icon can be found in app/assets/javascripts/reports/codequality_report/constants.js
current state of the json endpoint
URL: https://gitlab.com/USERl/
PROJECT/-/merge_requests/15/codequality_reports.json
{
"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
}
]
"summary": {
"total": 2,
"resolved": 0,
"errored": 2
}
}
future state of the endpoint:
URL: https://gitlab.com/USERl/
PROJECT/-/merge_requests/15/codequality_reports.json
response:
{
"new_errors": [
{
"description": "Remove this unused method parameter \"a\".",
"severity": "major",
"severityIcon": "severityMajor",
"file_path": "HelloWorld.java",
"line": 6
},
{
"description": "Method has 9 parameters, which is greater than 7 authorized.",
"severity": "major",
"severityIcon": "severityMajor",
"file_path": "HelloWorld.java",
"line": 6
}
],
"resolved_errors": [],
"existing_errors": [],
"summary": {
"total": 2,
"resolved": 0,
"errored": 2
}
}
https://gitlab.com/-/graphql-explorer):
Current state of the GraphQL endpoint request (with example forquery {
project(fullPath: "gitlab-org/gitlab") {
pipeline(iid: 1276595) {
codeQualityReports(first: 25, after: "") {
count
edges {
node {
line
description
path
fingerprint
severity
}
}
pageInfo {
startCursor
endCursor
hasNextPage
}
}
}
}
}
A non-exhaustive list of files that will need to be changed:
- ee/spec/graphql/types/ci/code_quality_degradation_type_spec.rb
- ee/app/graphql/types/ci/code_quality_degradation_type.rb
- ee/app/assets/javascripts/codequality_report/graphql/queries/get_code_quality_violations.query.graphql
- app/assets/javascripts/reports/codequality_report/constants.js
- lib/gitlab/ci/reports/codequality_reports.rb (?maybe?)