Commit 9fd035a1 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Copyedit code quality diff docs

parent 3ad517cc
# Analyze project code quality with Code Climate CLI # Analyze project code quality with Code Climate CLI
This example shows how to run [Code Climate CLI][cli] on your code by using\ This example shows how to run [Code Climate CLI][cli] on your code by using
GitLab CI and Docker. GitLab CI and Docker.
First, you need GitLab Runner with [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor). First, you need GitLab Runner with [docker-in-docker executor][dind].
Once you setup the Runner add new job to `.gitlab-ci.yml`: Once you setup the Runner, add a new job to `.gitlab-ci.yml`, called `codeclimate`:
```yaml ```yaml
codeclimate: codeclimate:
...@@ -25,4 +25,10 @@ codeclimate: ...@@ -25,4 +25,10 @@ codeclimate:
This will create a `codeclimate` job in your CI pipeline and will allow you to This will create a `codeclimate` job in your CI pipeline and will allow you to
download and analyze the report artifact in JSON format. download and analyze the report artifact in JSON format.
For GitLab [Enterprise Edition Starter][ee] users, this information can be automatically
extracted and shown right in the merge request widget. [Learn more on code quality
diffs in merge requests](../../user/project/merge_requests/code_quality_diff.md).
[cli]: https://github.com/codeclimate/codeclimate [cli]: https://github.com/codeclimate/codeclimate
[dind]: ../docker/using_docker_build.md#use-docker-in-docker-executor
[ee]: https://about.gitlab.com/gitlab-ee/
# Code quality diff # Code quality diff using Code Climate
> [Introduced][ee-1984] in GitLab Enterprise Edition 9.3. > [Introduced][ee-1984] in [GitLab Enterprise Edition Starter][ee] 9.3.
If you are using GitLab CI you can analyze your source code quality using If you are using [GitLab CI][ci], you can analyze your source code quality using
Code Climate analyzer docker image. Then GitLab will show you how merge request the [Code Climate][cc] analyzer [Docker image][cd]. Going a step further, GitLab
changes source code quality right inside merge request widget. can show the Code Climate report right in the merge request widget area.
![Code Quality Widget][quality-widget] ![Code Quality Widget][quality-widget]
## Enabling feature In order for the report to show in the merge request, you need to specify a
`codeclimate` job that will analyze the code and upload the resulting
`codeclimate.json` as an artifact. GitLab will then check this file and show
the information inside the merge request.
Feature can be enabled by following next steps: For more information on how the `codeclimate` job should look like, check the
example on [analyzing a project's code quality with Code Climate CLI][cc-docs].
1. [Analyze project code quality with Code Climate CLI ][cc-docs]
2. Start a new merge request from branch that already has codeclimate job succeed
3. Wait till merge request codeclimate job succeed
[ee-1984]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1984 [ee-1984]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1984
[ee]: https://about.gitlab.com/gitlab-ee/
[ci]: ../../../ci/README.md
[cc]: https://codeclimate.com
[cd]: https://hub.docker.com/r/codeclimate/codeclimate/
[quality-widget]: img/code_quality.gif [quality-widget]: img/code_quality.gif
[cc-docs]: https://docs.gitlab.com/ce/ci/examples/code_climate.html#analyze-project-code-quality-with-code-climate-cli [cc-docs]: ../../../ci/examples/code_climate.md
...@@ -107,11 +107,11 @@ creating merge commits, you can configure this on a per-project basis. ...@@ -107,11 +107,11 @@ creating merge commits, you can configure this on a per-project basis.
## Code quality diff ## Code quality diff
> Included in [GitLab Enterprise Edition Starter][products]. > Introduced in [GitLab Enterprise Edition Starter][products] 9.3.
If you are using GitLab CI you can analyze your source code quality using If you are using [GitLab CI][ci], you can analyze your source code quality using
Code Climate analyzer docker image. Then GitLab will show you how merge request the [Code Climate][cc] analyzer [Docker image][cd]. Going a step further, GitLab
changes source code quality right inside merge request widget. can show the Code Climate report right in the merge request widget area.
[Read more about code quality diff.](code_quality_diff.md) [Read more about code quality diff.](code_quality_diff.md)
...@@ -216,3 +216,6 @@ git checkout origin/merge-requests/1 ...@@ -216,3 +216,6 @@ git checkout origin/merge-requests/1
[protected branches]: ../protected_branches.md [protected branches]: ../protected_branches.md
[products]: https://about.gitlab.com/products/ "GitLab products page" [products]: https://about.gitlab.com/products/ "GitLab products page"
[ci]: ../../../ci/README.md
[cc]: https://codeclimate.com/
[cd]: https://hub.docker.com/r/codeclimate/codeclimate/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment