Skip to content

Add field severityIcon to code quality response

Arpit Gogia requested to merge arpit-patch-355714 into master

As per this discussion, this MR was closed since the mapped icon name is a front-end implementation detail with little significance in a public API response

What does this MR do and why?

Adds a severityIcon field to the code quality reports API response (GraphQL and JSON(private)). This value directly maps to the icon name used on the UI.

Relevant issue: #355714 (closed)

Screenshots or screen recordings

GraphQL image
REST image

How to set up and validate locally

  1. Start Gitlab (gdk start)
  2. Create a repository, add some code and enable Code Quality
  3. Create an MR and check the response:
    1. <group>/<repository>/-/merge_requests/<mr_id>/codequality_reports.json. Alternatively, open the MR page and append /codequality_reports.json to the URL
    2. Use the below GraphQL query in the GraphQL Explorer (-/graphql-explorer)
GraphQL Query
query {
  project(fullPath: "<group>/<repository>") {
    pipeline(iid: <mr_iid>) {
      codeQualityReports(first: 2, after: "") {
        count
        edges {
          node {
            line
            description
            path
            fingerprint
            severity
            webUrl
            severityIcon
          }
        }
        pageInfo {
          startCursor
          endCursor
          hasNextPage
        }
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Arpit Gogia

Merge request reports