Skip to content
Snippets Groups Projects
Commit 965d87a2 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Merge branch 'feature/sm/2783-rename-codeclimate-to-codequality' into 'master'

Support `codequality` job name for Code Quality feature

Closes #2783

See merge request !2704
parents 043f96eb d4358566
No related branches found
No related tags found
1 merge request!2704Support `codequality` job name for Code Quality feature
Pipeline #
Loading
Loading
@@ -37,7 +37,7 @@ def persisted_environment
scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) }
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) }
scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) }
scope :codeclimate, ->() { where(name: 'codeclimate') }
scope :codequality, ->() { where(name: %w[codequality codeclimate]) }
 
mount_uploader :artifacts_file, ArtifactUploader
mount_uploader :artifacts_metadata, ArtifactUploader
Loading
Loading
Loading
Loading
@@ -442,7 +442,7 @@ def detailed_status(current_user)
end
 
def codeclimate_artifact
artifacts.codeclimate.find(&:has_codeclimate_json?)
artifacts.codequality.find(&:has_codeclimate_json?)
end
 
private
Loading
Loading
---
title: Support `codequality` job name for Code Quality feature
merge_request: 2704
author:
type: changed
Loading
Loading
@@ -50,12 +50,15 @@ Apart from those, here is an collection of tutorials and guides on setting up yo
- **Articles:**
- [Setting up GitLab CI for Android projects](https://about.gitlab.com/2016/11/30/setting-up-gitlab-ci-for-android-projects/)
 
### Code quality analysis
- [Analyze code quality with the Code Climate CLI](code_climate.md)
### Other
 
- [Using `dpl` as deployment tool](deployment/README.md)
- [Repositories with examples for various languages](https://gitlab.com/groups/gitlab-examples)
- [The .gitlab-ci.yml file for GitLab itself](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab-ci.yml)
- [Analyze code quality with the Code Climate CLI](code_climate.md)
- **Articles:**
- [Continuous Deployment with GitLab: how to build and deploy a Debian Package with GitLab CI](https://about.gitlab.com/2016/10/12/automated-debian-package-build-with-gitlab-ci/)
 
Loading
Loading
Loading
Loading
@@ -5,10 +5,10 @@ GitLab CI 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 `codeclimate`:
Once you set up the Runner, add a new job to `.gitlab-ci.yml`, called `codequality`:
 
```yaml
codeclimate:
codequality:
image: docker:latest
variables:
DOCKER_DRIVER: overlay
Loading
Loading
@@ -22,7 +22,7 @@ codeclimate:
paths: [codeclimate.json]
```
 
This will create a `codeclimate` job in your CI pipeline and will allow you to
This will create a `codequality` job in your CI pipeline and will allow you to
download and analyze the report artifact in JSON format.
 
For GitLab [Enterprise Edition Starter][ee] users, this information can be automatically
Loading
Loading
Loading
Loading
@@ -27,8 +27,14 @@ For instance, consider the following workflow:
 
## How it works
 
>**Note:**
In [GitLab Enterprise Edition Starter][ee] 10.0, another job name will
also be supported: `codequality`. This new job name will eventually replace
`codeclimate` which is scheduled to be removed in GitLab 11.0. You are advised
to update your current `.gitlab-ci.yml` configuration to reflect that change.
In order for the report to show in the merge request, you need to specify a
`codeclimate` job (exact name) that will analyze the code and upload the resulting
`codequality` job (exact name) 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.
 
Loading
Loading
@@ -38,11 +44,11 @@ Code Climate display in the merge request.
 
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
`codeclimate` job in your `.gitlab-ci.yml` for the very first time.
`codequality` 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 `codeclimate` job should look like, check the
For more information on how the `codequality` job should look like, check the
example on [analyzing a project's code quality with Code Climate CLI][cc-docs].
 
[ee-1984]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1984
Loading
Loading
Loading
Loading
@@ -12,6 +12,28 @@
 
let(:job) { create(:ci_build, pipeline: pipeline) }
 
describe '.codequality' do
subject { described_class.codequality }
context 'when a job name is codequality' do
let!(:job) { create(:ci_build, pipeline: pipeline, name: 'codequality') }
it { is_expected.to include(job) }
end
context 'when a job name is codeclimate' do
let!(:job) { create(:ci_build, pipeline: pipeline, name: 'codeclimate') }
it { is_expected.to include(job) }
end
context 'when a job name is irrelevant' do
let!(:job) { create(:ci_build, pipeline: pipeline, name: 'codechecker') }
it { is_expected.not_to include(job) }
end
end
describe '#shared_runners_minutes_limit_enabled?' do
subject { job.shared_runners_minutes_limit_enabled? }
 
Loading
Loading
@@ -112,7 +134,7 @@
create(
:ci_build,
:artifacts,
name: 'codeclimate',
name: 'codequality',
pipeline: pipeline,
options: {
artifacts: {
Loading
Loading
@@ -130,7 +152,7 @@
create(
:ci_build,
:artifacts,
name: 'codeclimate',
name: 'codequality',
pipeline: pipeline,
options: {}
)
Loading
Loading
Loading
Loading
@@ -1325,12 +1325,12 @@ def create_build(name, stage_idx)
end
 
describe '#codeclimate_artifact' do
context 'has codeclimate build' do
context 'has codequality job' do
let!(:build) do
create(
:ci_build,
:artifacts,
name: 'codeclimate',
name: 'codequality',
pipeline: pipeline,
options: {
artifacts: {
Loading
Loading
@@ -1343,7 +1343,7 @@ def create_build(name, stage_idx)
it { expect(pipeline.codeclimate_artifact).to eq(build) }
end
 
context 'no codeclimate build' do
context 'no codequality job' do
before do
create(:ci_build, pipeline: pipeline)
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment