Code Quality templates¶
The Code Quality template file codequality.yml
can be included via
include:
- project: computing/gitlab-ci-templates
file: codequality.yml
This file provides the following job templates:
.codequality:combine
¶
Description¶
Combines multiple Code Quality reports into a single report, to work around the GitLab limitation that only a single Code Quality report can be displayed.
The following variables can be used to configure the build:
Name | Default | Purpose |
---|---|---|
CODEQUALITY_GLOB | "*.json" | glob string to identify reports to combine |
Example usage¶
include:
- project: computing/gitlab-ci-templates
file:
- codequality.yml
- python.yml
flake8:
stage: analysis
extends:
- .python:flake8
# upload flake8 report as artifact to be used by codequality
artifacts:
paths:
- flake8.json
radon:
stage: analysis
extends:
- .python:radon
# upload radon report as artifact to be used by codequality
artifacts:
paths:
- radon.json
codequality:
stage: .post
extends:
- .codequality:combine
needs:
- flake8
- radon
.codequality:markdownlint
¶
Description¶
Runs markdownlint
over a project/directory using markdownlint-cli
.
The following variables can be used to configure the build:
Name | Default | Purpose |
---|---|---|
MARKDOWNLINT_OPTIONS | ${CI_PROJECT_DIR} | options to pass to markdownlint-cli , defaults to scanning the whole project |
Example usage¶
include:
- project: computing/gitlab-ci-templates
file:
- codequality.yml
markdownlint:
stage: analysis
extends: .codequality:markdownlint
.codequality:shellcheck
¶
Description¶
Runs shellcheck
over one or more files in a project.
The following variables can be used to configure the build:
Name | Default | Purpose |
---|---|---|
SHELLCHECK_TARGETS | "*.sh" | wildcard to pass to find . -path <> to locate files to check (see manual for details of -path syntax) |
SHELLCHECK_OPTIONS | ${CI_PROJECT_DIR} | options to pass to shellcheck-cli , defaults to scanning the whole project |
Jobs using this template will not fail when lint is found
Jobs that use this template will always pass when the linter executes successfully, regardless of what lint is found.
Users should rely upon the Code Quality merge request widget visible from the GitLab web interface.
Example usage¶
include:
- project: computing/gitlab-ci-templates
file:
- codequality.yml
shellcheck:
stage: analysis
extends: .codequality:shellcheck