Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3b08d036
Commit
3b08d036
authored
Aug 07, 2018
by
Matija Čupić
Committed by
Achilleas Pipinellis
Aug 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code Quality is supported on GitLab >= 10.4
parent
618d674a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
doc/ci/examples/code_quality.md
doc/ci/examples/code_quality.md
+31
-9
No files found.
doc/ci/examples/code_quality.md
View file @
3b08d036
# Analyze your project's Code Quality
CAUTION:
**Caution:**
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:**
Code Quality was previously using
`codeclimate`
and
`codequality`
for job name and
`codeclimate.json`
for the artifact name. While these old names
are still maintained they have been deprecated with GitLab 11.0 and may be removed
in next major release, GitLab 12.0. You are advised to update your current
`.gitlab-ci.yml`
configuration to reflect that change.
This example shows how to run Code Quality on your code by using GitLab CI/CD
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`
, called
`code_quality`
:
Once you set up the Runner, add a new job to
`.gitlab-ci.yml`
, called
`code_quality`
.
```
yaml
code_quality
:
...
...
@@ -15,8 +26,7 @@ code_quality:
allow_failure
:
true
services
:
-
docker:stable-dind
script
:
-
export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
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
...
...
@@ -37,12 +47,24 @@ 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
)
.
CAUTION:
**Caution:**
Code Quality was previously using
`codeclimate`
and
`codequality`
for job name and
`codeclimate.json`
for the artifact name. While these old names
are still maintained they have been deprecated with GitLab 11.0 and may be removed
in next major release, GitLab 12.0. You are advised to update your current
`.gitlab-ci.yml`
configuration to reflect that change.
## Old job definition
For GitLab 10.3 and earlier, the job should look like:
```
yaml
codequality
:
image
:
docker:latest
variables
:
DOCKER_DRIVER
:
overlay
services
:
-
docker:dind
script
:
-
docker pull codeclimate/codeclimate:0.69.0
-
docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate:0.69.0 init
-
docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate:0.69.0 analyze -f json > codeclimate.json ||
true
artifacts
:
paths
:
[
codeclimate.json
]
```
[
cli
]:
https://github.com/codeclimate/codeclimate
[
dind
]:
../docker/using_docker_build.md#use-docker-in-docker-executor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment