summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-21 15:02:53 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-02-21 15:02:53 +0000
commit0922027877ea08b42b171f5ab2c4e35eabf4f734 (patch)
tree3281bc65db9e820ca39d56b4af3ce3ef7b0cd4a3 /scripts
parent48b1455566a51f4dea6b3b86553d2f239266a1f9 (diff)
parent5ccd3bec955c1869ad621d352c6509365f2077dc (diff)
downloadgitlab-ce-0922027877ea08b42b171f5ab2c4e35eabf4f734.tar.gz
Merge branch 'improve-codequality-job' into 'master'
Merge branch 'improve-codequality-job' into 'master' See merge request gitlab-org/gitlab-ce!17263
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/codequality18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/codequality b/scripts/codequality
new file mode 100755
index 00000000000..9fa692999f3
--- /dev/null
+++ b/scripts/codequality
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -eo pipefail
+
+code_path=$(pwd)
+
+# docker run --tty will merge stderr and stdout, we don't need this on CI or
+# it will break codequality json file
+[ "$CI" != "" ] || docker_tty="--tty"
+
+docker pull dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1 > /dev/null
+docker tag dev.gitlab.org:5005/gitlab/gitlab-build-images:gitlab-codeclimate-rubocop-0-52-1 codeclimate/codeclimate-rubocop:gitlab-codeclimate-rubocop-0-52-1 > /dev/null
+
+exec docker run --rm $docker_tty --env CODECLIMATE_CODE="$code_path" \
+ --volume "$code_path":/code \
+ --volume /var/run/docker.sock:/var/run/docker.sock \
+ --volume /tmp/cc:/tmp/cc \
+ "codeclimate/codeclimate:${CODECLIMATE_VERSION:-0.71.1}" "$@"