# Gitlab Code Quality

**URL:** <https://forum.gitlab.com/t/gitlab-code-quality/34704>\
**Category:** DevSecOps\
**Tags:** ci, runner\
**Created:** [February 24, 2020, 2:59pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704 "2020-02-24T14:59:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giovanni2293](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@Giovanni2293](https://forum.gitlab.com/u/Giovanni2293)\
**Post date:** [February 24, 2020, 2:59pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/1 "2020-02-24T14:59:47Z")

</div>

### _Greetings_

_Im currently trying to integrate our proyect with code quality. I followed the steps from here [https://docs.gitlab.com/ee/user/project/merge\_requests/code\_quality.html](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html) but it doesn’t show code quality in widget._

- _Repository allocated in [Gitlab.com](http://Gitlab.com) Free user for the repo_
- _Runner (Hint: `/admin/runners`):version 12.7.1 locally configured on linux ubuntu using shell in a machine with docker_

_however for this test project i tried to use a shared runner and a image wtih java._

#### gitlab-ci.yml

```auto
image: java:latest

stages:
  - build
  - test
  - execute

include:
  - template: Code-Quality.gitlab-ci.yml

build:
  stage: build
  script: /usr/lib/jvm/java-8-openjdk-amd64/bin/javac HelloWorld.java
  artifacts:
    paths:
     - HelloWorld.*

code_quality:
  stage: test
  artifacts:
    paths: [gl-code-quality-report.json]

execute:
  stage: execute
  script: /usr/lib/jvm/java-8-openjdk-amd64/bin/java HelloWorld

```

_I tried also usign the local runner using the docker installation configured locally but without success in both sceneries._

 ![image](https://us1.discourse-cdn.com/gitlab/original/2X/7/76aa6fc28e087e594d96208ccb89054d702d0078.png)

#### _Later, i have found that i need to pay at least Bronze licence to get this feature, however, my project also has collaborators._

 ![image](https://us1.discourse-cdn.com/gitlab/original/2X/7/76aa6fc28e087e594d96208ccb89054d702d0078.png)

My question is: ¿Does only the account owner of repository needs to have Bronze licence to enable that feature or its needed also for the collaborators in the repo to make it work?

Thank you for your attention.

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [February 24, 2020, 4:13pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/2 "2020-02-24T16:13:27Z")

</div>

@Giovanni2293 - Product Manager for the testing group here. This feature is available in Core so you won’t need a Bronze license to use it, sorry for the confusion!

---

<div class="post-metadata">

**Author:** ![Giovanni2293](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@Giovanni2293](https://forum.gitlab.com/u/Giovanni2293)\
**Post date:** [February 24, 2020, 6:12pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/3 "2020-02-24T18:12:40Z")

</div>

Hello.

If it’s included on core, i would like to get help because it shows:

 ![image](https://us1.discourse-cdn.com/gitlab/original/2X/a/a34b93439d42067ec249d0518670bb6c9efefc40.png)

I followed the instructions shown in the site. Any help would be apreciated.

Repo url: [https://gitlab.com/Giovanni2293/movilcodeclimatetest](https://gitlab.com/Giovanni2293/movilcodeclimatetest)

Have a good day and thanks for help.

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [February 24, 2020, 9:51pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/4 "2020-02-24T21:51:11Z")

</div>

You can browse to and download the report from the [job page](https://gitlab.com/Giovanni2293/movilcodeclimatetest/-/jobs/446703197), see the right hand side.

In the not too distant future there will be a view of the [full report](https://gitlab.com/gitlab-org/gitlab/issues/4189) on the pipeline page as well.

Hopefully this helps @Giovanni2293

---

<div class="post-metadata">

**Author:** ![Giovanni2293](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@Giovanni2293](https://forum.gitlab.com/u/Giovanni2293)\
**Post date:** [February 24, 2020, 10:06pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/5 "2020-02-24T22:06:34Z")

</div>

@jheimbuck_gl is this feature described on [https://docs.gitlab.com/ee/user/project/merge\_requests/code\_quality.html](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html) included yet?

 ![image](https://us1.discourse-cdn.com/gitlab/original/2X/b/b831ee095458e43c409ac140fd3758e63faed247.png)

im a bit confused. The feature i want to enable is the coments on the Merge request from Code climate but i can’t figure how to make it work.

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [February 24, 2020, 10:37pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/6 "2020-02-24T22:37:26Z")

</div>

Yes it is live/included. You can see it on [this MR](https://gitlab.com/jheimbuck_gl/code_quality_example/-/merge_requests/10) on a sample project. Code Quality needs to run against the target branch to set a baseline and then against the source branch AND there is a change in the report before the widget will have content though.

---

<div class="post-metadata">

**Author:** ![Giovanni2293](https://avatars.discourse-cdn.com/v4/letter/g/2bfe46/32.png) [@Giovanni2293](https://forum.gitlab.com/u/Giovanni2293)\
**Post date:** [February 24, 2020, 10:57pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/7 "2020-02-24T22:57:31Z")

</div>

It worked!, thank you for the help.

 ![image](https://us1.discourse-cdn.com/gitlab/original/2X/9/9eba12df91b110027930a1e70985623243314d66.png)

---

<div class="post-metadata">

**Author:** ![bardia](https://avatars.discourse-cdn.com/v4/letter/b/71c47a/32.png) [@bardia](https://forum.gitlab.com/u/bardia)\
**Post date:** [March 24, 2020, 7:15pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/8 "2020-03-24T19:15:16Z")

</div>

If a branch is created, before the code climate job is run on master, and you rebase master onto that older branch, should the MR be showing up on the branch?

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [March 25, 2020, 6:11pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/9 "2020-03-25T18:11:24Z")

</div>

@bardia - I haven’t tried that use case out and am not certain. If you have tried this yourself let us know how it goes. I will try to replicate on our side as well.

-JH

---

<div class="post-metadata">

**Author:** ![rclarke](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/rclarke/32/14614_2.png) [@rclarke](https://forum.gitlab.com/u/rclarke)\
**Post date:** [August 4, 2020, 1:41pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/10 "2020-08-04T13:41:18Z")

</div>

you said before its available in the Community Edition. However i cant seem to see why the Code Quality Report Tab is not showing up on the MR pipeline.?

however in your documentation it states : Code Quality Reports (STARTER)???

> **[Code quality · Merge requests · Project · User · Help](https://gitlab.com/help/user/project/merge_requests/code_quality#code-quality-reports)**
>
> GitLab.com

I am generating the code quality report manually, because we’re using SonarQube, and we’re doing code quality on SQL, so for us theres no need for code climate, or the codeclimate yml - only produce the json file.

however, the code quality report is not showing up on the MR, nor the pipeline, and I have a code quality json already in master as a comparison,

any ideas why its not showing ?  
thanks

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [August 4, 2020, 6:43pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/11 "2020-08-04T18:43:28Z")

</div>

@rclarke thanks for posting! The Code Quality report on the pipeline page is a Starter feature. The Code Quality Widget that appears on the Merge Request page is a Core feature.

As far as troubleshooting goes we have [documented](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#no-code-quality-report-is-displayed-in-a-merge-request) some common tips. Beyond that if you can share the Merge Request / Project you’re expecting to see the widget on the community here may be able to help.

-James H - GitLab Product Manager

---

<div class="post-metadata">

**Author:** ![rclarke](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/rclarke/32/14614_2.png) [@rclarke](https://forum.gitlab.com/u/rclarke)\
**Post date:** [August 5, 2020, 7:10pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/12 "2020-08-05T19:10:45Z")

</div>

unfortunately i cant share the project. I have looked into all the documentation, and according to your words, it should be being visible in the MR widget. But whats strange is that its not showing up. Does the filename in the codeclimate.json HAVE to point to the exact filename (case sensitive)? eg: src/xxxx/xxxxx/myfilename.sql  
also, do i need to put this snippet in aswell? keeping in mind that im manually creating my own codeclimate.json file.?

include:

- template: Code-Quality.gitlab-ci.yml

thanks for your all help/assistance. 😉

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [August 6, 2020, 12:48pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/13 "2020-08-06T12:48:28Z")

</div>

@rclarke as long as the job creating the .json file has it formatted correctly and you use the `[artifacts:reports:codequality](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#artifactsreportscodequality)` label the file should be picked up.

I’m not sure about filename case but the codeclimate docs may point you in the right direction there.

-JH

---

<div class="post-metadata">

**Author:** ![rclarke](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/rclarke/32/14614_2.png) [@rclarke](https://forum.gitlab.com/u/rclarke)\
**Post date:** [August 9, 2020, 12:58pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/14 "2020-08-09T12:58:03Z")

</div>

Hi, sorry to be a pain.

in custom reports, I assume:

1. i dont need to specify the include: .codeclimate.yml
2. I dont have to include a code\_quality: job. as i can actually just place the artifacts:reports:codequality:codeclimate.json stub.

Im finding it hard to actually test these things, and im still unable to get code quality to appear on the merge request… ☹

do you possibly have an example, on a Community Edition, working.? thanks.

Regards

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [August 9, 2020, 11:39pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/15 "2020-08-09T23:39:27Z")

</div>

@rclarke - Here’s an [example](https://gitlab.com/jheimbuck_gl/custom_cq_test/-/merge_requests/3) for you. The .sh file creates the `'gl-code-quality-report.json'` file with the contents from the docs.

You’d replace this with whatever is doing the analysis and put that into a file that matches what you set in `artifacts:reports:codequality:<yourfilehere>`.

This is working for me on a private project on the free plan in addition to the example above.

I hope this helps!

-James

---

<div class="post-metadata">

**Author:** ![rclarke](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/rclarke/32/14614_2.png) [@rclarke](https://forum.gitlab.com/u/rclarke)\
**Post date:** [August 10, 2020, 6:29pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/16 "2020-08-10T18:29:07Z")

</div>

Hi James.  
I hope i dont sound like a broken record. lol

anyway, everything you’ve shown me in the demo is same as how im doing it. apart from 1 thing:  
you seem to create a codeclimate.json in master before hand, and yet you create a gl-code-quality-report.json in the MR. is that right?

UPDATE: we upgraded to 13.2, and viola ! we are now seeing Code Quality boxes in the MR ?  
perhaps it was just that. anyway - THANKS A LOAD for your help and patience! you’re a star!

So now i know it DOES work in CE. However, ive now hit another snag, I think it only compares it to latest HEAD in master, and if master did not collate a code quality report on that latest job, a new MR will fail to produce - and show the “base code quality artifiact not present” message. I think it should actually compare to the latest code quality report it has from master over all jobs - dont you think ?

I await your feedback. but thanks James for helping me on this - its been interesting I’ll give it that.

Regards  
Richard

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [August 10, 2020, 7:02pm UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/17 "2020-08-10T19:02:47Z")

</div>

@rclarke - Ah, the Code Quality MR widget was not available in CE until 13.2, that is probably what happened.

You are correct about how the MR widget compares reports today. We are discussing an alternate approach in an [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/217981) and we’d love to have you contribute to the discussion there.

-James

---

<div class="post-metadata">

**Author:** ![rclarke](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/rclarke/32/14614_2.png) [@rclarke](https://forum.gitlab.com/u/rclarke)\
**Post date:** [August 11, 2020, 11:56am UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/18 "2020-08-11T11:56:43Z")

</div>

Thanks James. I’ll keep an eye on that. Happy to test for you in the wild, dont wanna get too much involved in your disccussions for now, but happy to listen and test where i can.

Richard

---

<div class="post-metadata">

**Author:** ![Native-Coder](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@Native-Coder](https://forum.gitlab.com/u/Native-Coder)\
**Post date:** [October 18, 2020, 12:37am UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/19 "2020-10-18T00:37:32Z")

</div>

> [@jheimbuck\_gl](#):
>
> [Job artifacts | GitLab](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#artifactsreportscodequality)

How do I tell the code quality job to only scan a certain directory?

---

<div class="post-metadata">

**Author:** ![jheimbuck\_gl](https://sea2.discourse-cdn.com/gitlab/user_avatar/forum.gitlab.com/jheimbuck_gl/32/8112_2.png) [@jheimbuck\_gl](https://forum.gitlab.com/u/jheimbuck_gl)\
**Post date:** [October 18, 2020, 1:20am UTC](https://forum.gitlab.com/t/gitlab-code-quality/34704/20 "2020-10-18T01:20:36Z")

</div>

@Native-Coder - Thanks for the ping! I answered your question in your [original post](https://forum.gitlab.com/t/code-quality-job-is-refusing-to-obey-source-code-env-variable/44077/2). The short version is it looks like you are on a version that didn’t fix the bug that prevents you from using that but you can exclude other directories in the .codeclimate.yml file.

-James H, GitLab Product Manager, Verify:Testing

[Next page](https://forum.gitlab.com/t/gitlab-code-quality/34704.md?page=2)
