Commit baac8a77 authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'mc/fix-codequality-documentation' into 'master'

Revert "Update code quality documentation"

See merge request gitlab-org/gitlab-ee!7913
parents 4425d208 743a5728
# Analyze your project's Code Quality
CAUTION: **Caution:**
The job definition shown below is supported on GitLab 11.4 and later versions.
The job definition shown below is supported on GitLab 10.4 and later versions.
For earlier versions, use the [old job definition](#old-job-definition).
CAUTION: **Caution:**
......@@ -16,7 +16,7 @@ and Docker.
First, you need GitLab Runner with [docker-in-docker executor][dind].
Once you set up the Runner, add a new job to `.gitlab-ci.yml`.
Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called `code_quality`.
```yaml
code_quality:
......@@ -34,50 +34,22 @@ code_quality:
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
reports:
codequality: [gl-code-quality-report.json]
paths: [gl-code-quality-report.json]
```
The above example will create a `code_quality` job in your CI/CD pipeline which
will scan your source code for code quality issues. The report will be saved
as an artifact that you can later download and analyze.
TIP: **Tip:**
Starting with [GitLab Starter][ee] 11.4, this information will be automatically
extracted and shown right in the merge request widget. To do so, the CI/CD job
must have a codequality report artifact. Due to implementation limitations we
always take the latest codequality artifact available.
[Learn more on Code Quality in merge requests](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html).
TIP: **Tip:**
Starting with [GitLab Starter][ee] 9.3, this information will
be automatically extracted and shown right in the merge request widget. To do
so, the CI/CD job must be named `code_quality` and the artifact path must be
`gl-code-quality-report.json`.
[Learn more on Code Quality in merge requests](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html).
## Old job definition
For GitLab 11.3 and earlier, the job should look like:
```yaml
code_quality:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [gl-code-quality-report.json]
```
For GitLab 10.3 and earlier, the job should look like:
```yaml
......
......@@ -27,19 +27,19 @@ For instance, consider the following workflow:
## How it works
In order for the report to show in the merge request, you need to specify a job
that will analyze the code and upload the resulting output JSON as a codequality
report artifact. GitLab will then check this file and show the information
inside the merge request.
In order for the report to show in the merge request, you need to specify a
`code_quality` job (exact name) that will analyze the code and upload the resulting
`gl-code-quality-report.json` as an artifact. GitLab will then check this file and show
the information inside the merge request.
>**Note:**
If the Code Climate report doesn't have anything to compare to, no information
will be displayed in the merge request area. That is the case when you add the
code quality job in your `.gitlab-ci.yml` for the very first time.
`code_quality` job in your `.gitlab-ci.yml` for the very first time.
Consecutive merge requests will have something to compare to and the code quality
report will be shown properly.
For more information on how the code quality job should look like, check the
For more information on how the `code_quality` job should look like, check the
example on [analyzing a project's code quality with Code Climate CLI][cc-docs].
CAUTION: **Caution:**
......
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