Skip to content

Add new field webUrl to Code Quality APIs

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

What does this MR do and why?

Adds a new field webUrl to the Code Quality's GraphQL and private API (codequality_reports.json) response. This will help move the logic of building the path from the frontend to the backend.

Relevant issue: #355426 (closed)

Screenshots or screen recordings

REST API Screenshot_2022-10-20_at_20.54.18
GraphQL 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
          }
        }
        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

Loading