Commit f3feda0e authored by Remco Haszing's avatar Remco Haszing Committed by Evan Read

docs: Update code_quality.md

parent d052d768
...@@ -31,13 +31,50 @@ For instance, consider the following workflow: ...@@ -31,13 +31,50 @@ For instance, consider the following workflow:
First of all, you need to define a job in your `.gitlab-ci.yml` file that generates the First of all, you need to define a job in your `.gitlab-ci.yml` file that generates the
[Code Quality report artifact](../../../ci/yaml/README.md#artifactsreportscodequality). [Code Quality report artifact](../../../ci/yaml/README.md#artifactsreportscodequality).
The Code Quality report artifact is a subset of the
[Code Climate spec](https://github.com/codeclimate/spec/blob/master/SPEC.md#data-types).
It must be a JSON file containing an array of objects with the following properties:
| Name | Description |
| ---------------------- | -------------------------------------------------------------------------------------- |
| `description` | A description of the code quality violation. |
| `fingerprint` | A unique fingerprint to identify the code quality violation. For example, an MD5 hash. |
| `location.path` | The relative path to the file containing the code quality violation. |
| `location.lines.begin` | The line on which the code quality violation occurred. |
Example:
```json
[
{
"description": "'unused' is assigned a value but never used.",
"fingerprint": "7815696ecbf1c96e6894b779456d330e",
"location": {
"path": "lib/index.js",
"lines": {
"begin": 42
}
}
}
]
```
Note: **Note:**
Although the Code Climate spec supports more properties, those are ignored by GitLab.
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](../../../ci/examples/code_quality.md). example on [analyzing a project's code quality](../../../ci/examples/code_quality.md).
GitLab then checks this report, compares the metrics between the source and target GitLab then checks this report, compares the metrics between the source and target
branches, and shows the information right on the merge request. branches, and shows the information right on the merge request.
>**Note:** Caution: **Caution:**
If multiple jobs in a pipeline generate a code quality artifact, only the artifact from
the last created job (the job with the largest job ID) is used. To avoid confusion,
configure only one job to generate a code quality artifact.
Note: **Note:**
If the Code Quality report doesn't have anything to compare to, no information If the Code Quality 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 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.
......
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