Codequality report is not present on MR page

Steps to reproduce:

  1. create a json file somewhere in the project folder (i.e. example.json)
  2. insert the following lines inside (they are taken from https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool)

[
{
“description”: “‘unused’ is assigned a value but never used.”,
“fingerprint”: “7815696ecbf1c96e6894b779456d330e”,
“location”: {
“path”: “lib/index.js”,
“lines”: {
“begin”: 42
}
}
}
]

  1. in the project yml, add example.json to job’s artifacts and also codequality (artifacts:reports:codequality:)
  2. launch the job
  3. observe that the file is successfully parsed and uploaded. For instance, I see:

quality/example.json: found 1 matching files
Uploading artifacts to coordinator… ok id=192742 responseStatus=201 Created token=-kEeCzbg

  1. observe that “Job artifacts” block on the right contains this file (which is also fine)
  2. visit the job’s corresponding MR page

AR: the report is not present anywhere on the page
ER: the report is displayed

Hi @kryanod welcome to the GitLab forum and thanks for posting!

The Code Quality Merge Request widget shows the difference between the code quality reports of the target and source branch, not the full body of the report. The full body is available as a download as you saw and in the UI on the pipeline details page and the Code Quality report tab.

-James H

Hi! Thanks for your reply.
Problem is: the full body of the report is nowhere to be seen in the pipeline details page (there is no quality report page or anything like that). Please see the screenshots.

It doesn’t look like you have a code quality job in your pipeline. That’s what creates and stores the artifacts to be parsed for the Merge Request Widget and the Code Quality Report Tab (see screenshot below). I recorded a walk through of this for the GitLab Unfiltered YouTube channel. I hope it helps!

-James

Thanks for your reply.
You are right, I don’t have a code quality job in my pipeline. I’m trying to have another tool generate the report in the code quality format, and publish it to get that nice “see results on the MR page” result.
I was referring to this documentation: https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
Did I get it right? If my report matches the format and I publish it via artifacts:reports:codequality:, it will be published as if it was an authentic code quality report. At first, I thought something’s wrong with my tool, but then I created a simple static json file and tried to upload it, and still no luck. Could you please re-read my first message, it might make a bit more sense now (sorry if I’m being a pain).

Just having a report in the repo will not cause the MR widget to populate. There still needs to be a job that does the upload of the code quality artifact even if it’s pulling it from somewhere else. I don’t have an example handy to show how to do this but if you get it working let us know! Good luck!

-JH

I’m afraid I’m confused, and I desperately need your help.
In order to publish, say, a junit report, I need to 1. have a file 2. export it via artifacts:reports:junit:. And that’s it, the junit report is displayed as a widget on the MR page.
You are saying that the same two steps applied to code quality are not enough? I.e. apart from 1. having the report and 2. exporting it via artifacts:reports:codequality:, there needs to be a step 3? Why?
Also, the job file doesn’t appear to be doing anything fancy to publish the report.

@kryanod - I think there may be some confusion about the contents of the MR widget. Let me try to break it down.

  • The MR Widget shows the changes from the code quality report of the target branch and the source branch.
  • The Code Quality Report on the pipeline page shows the full list of issues found in the source branch.

I’ve opened an issue to clarify this distinction in the docs.

If you need further support I’d suggest opening a support ticket and our team can assist you further.

Thanks!