No description
This repository has been archived on 2026-11-17. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • HTML 60.2%
  • Shell 39.3%
  • Dockerfile 0.5%
Find a file
2022-09-12 23:38:16 +02:00
.gitlab/issue_templates Set default MR template 2022-08-18 18:31:43 +08:00
codeclimate_defaults add shellcheck 2022-09-12 23:08:02 +02:00
test Update codeclimate to v0.85.24 2021-06-02 14:40:03 -04:00
.gitignore Add tests to confirm eslint related magic 2020-08-13 21:13:29 +08:00
.gitlab-ci.yml fix build 2022-09-12 23:05:04 +02:00
CHANGELOG.md chore: Bump CHANGELOG to 0.85.29 2022-07-08 21:25:10 +00:00
CONTRIBUTING.md Add codequality project 2020-02-27 14:50:34 +00:00
Default.md Set default MR template 2022-08-18 18:31:43 +08:00
Dockerfile Add codequality project 2020-02-27 14:50:34 +00:00
LICENSE Updating LICENSE file to MIT License 2021-06-18 12:23:37 +00:00
README.md Add link to feature docs in CodeQuality README 2021-05-21 15:42:21 +00:00
run.sh update version 2022-09-12 23:28:53 +02:00
test.sh Updated CodeClimate Version to 0.85.29 2022-07-08 17:07:48 +00:00
VERSION update codeclimate 2022-09-12 23:09:43 +02:00

GitLab Code Quality

pipeline status coverage report

GitLab tool for running Code Quality checks on provided source code. It is currently based on CodeClimate only, but this may change in the future.

For documentation about using this feature as part of a GitLab pipeline and with merge requests, see the feature documentation.

How to use

  1. cd into the directory of the source code you want to scan

  2. Run the Docker image:

    docker run \
      --env SOURCE_CODE="$PWD" \
      --volume "$PWD":/code \
      --volume /var/run/docker.sock:/var/run/docker.sock \
      registry.gitlab.com/gitlab-org/ci-cd/codequality:${VERSION:-latest} /code
    

    VERSION can be replaced with the latest available release matching your GitLab version. See Versioning for more details.

  3. The results will be stored in the gl-code-quality-report.json file in the application directory.

Why mounting the Docker socket?

Some tools require to be able to launch Docker containers to scan your application.

Environment variables

Code Quality can be configured with environment variables, here is a list:

Name Function
SOURCE_CODE Path to the source code to scan
TIMEOUT_SECONDS Custom timeout for the codeclimate analyze command
CODECLIMATE_DEBUG Set to enable Code Climate debug mode
CODECLIMATE_DEV Set to enable --dev mode which lets you run engines not known to the CLI.
REPORT_STDOUT Set to print the report to STDOUT instead of generating the usual report file.
REPORT_FORMAT Set to control the format of the generated report file. One of: json|html
ENGINE_MEMORY_LIMIT_BYTES Set the memory limit for engines, default is 1,024,000,000 bytes.
CODECLIMATE_PREFIX Set a prefix to use with all docker pull commands in CodeClimate engines. Useful for offline scanning.

Configuration

GitLab Code Quality comes with some default engines enabled and default configurations but we encourage you to customize them to your own needs. Please refer to CodeClimate documentation to learn more.

Versioning and release cycle

GitLab Code Quality versions follow the Code Climate versions used and is available as a Docker image.

For example, if the current version of Code Climate used is 0.85.5 and there are no other changes introduced yet to Code Quality, the image would be:

  • registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.5

If there are changes made but the Code Climate version is still 0.85.5, the image would then have the appended incremental version:

  • registry.gitlab.com/gitlab-org/ci-cd/codequality:0.85.5-gitlab.1

When we update to a newer version of Code Climate, we restart the version without the appended -gitlab.x. For example, if there is a version 0.99.1 released:

  • registry.gitlab.com/gitlab-org/ci-cd/codequality:0.99.1

Old Versioning Scheme

GitLab Code Quality used to follow the versioning of GitLab (MAJOR.MINOR versions only, like 12.4) with images tagged with MAJOR-MINOR-stable.

For those who are not able to migrate yet to the new versioning scheme, we released images for 12-5-stable, 12-6-stable, 12-7-stable, 12-8-stable, 12-9-stable, 12-10-stable that are copies of 12-4-stable. Please note that we will not backport future modifications to these old versions.

Please note that the Auto-DevOps feature automatically uses the correct version. If you have your own .gitlab-ci.yml in your project, please ensure you are up-to-date with the Auto-DevOps template.

Contributing

If you want to help and extend the list of supported scanners, read the contribution guidelines.