August 2019
Beginner
608 pages
16h 7m
English
A nice feature that verifies code quality is a quality scan with CI/CD in GitLab. It makes use of the open source and free Code Climate engines (https://codeclimate.com/). It is embedded in a special Docker container that you can run within your GitLab runner. The following code is an example of a .gitlab-ci.yml file that runs such a scan:
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" ...
Read now
Unlock full access