Skip to content
Snippets Groups Projects
Commit d45a6d81 authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

ci: generate the style patch artifact

parent a9a6ba05
No related branches found
No related tags found
1 merge request!82CI: generate style artifact
...@@ -68,9 +68,33 @@ Check licenses: ...@@ -68,9 +68,33 @@ Check licenses:
interruptible: true interruptible: true
Check style: Check style:
extends: .common_pre_commit extends:
- .colorized
- .common_pre_commit
variables:
STYLE_PATCH: style.patch
script: script:
- pre-commit run --show-diff-on-failure --color=always --all-files - |
# pre-commit run --all-files
pre-commit run --color=always --all-files || {
printf "${RED}The source code does not meet the style requirements:\n
${CI_PROJECT_URL}/-/blob/${CI_DEFAULT_BRANCH}/CONTRIBUTING.md#coding-style.\n${DEFAULT}"
git diff --ignore-submodules --patch-with-raw > "${STYLE_PATCH}"
test -s "${STYLE_PATCH}" && {
printf "${RED}At least some of the issues can be resolved with the patch (see artifacts):\n
${CI_JOB_URL}/artifacts/raw/${STYLE_PATCH}.\n${DEFAULT}"
} || {
printf "${RED}The issues cannot be resolved with a patch.\n${DEFAULT}"
rm -rf "${STYLE_PATCH}"
}
exit 1
}
artifacts:
paths:
- ${STYLE_PATCH}
expose_as: 'Style Patch'
when: on_failure
rules: rules:
- if: $CI_PIPELINE_SOURCE == "web" - if: $CI_PIPELINE_SOURCE == "web"
when: manual when: manual
......
# Formatting and linting # Coding style
We use [`pre-commit`](https://pre-commit.com) hooks to maintain a set of We use [`pre-commit`](https://pre-commit.com) hooks to maintain a set of
formatting and linting rules. Although there is a CI job that runs for each formatting and linting rules. Although there is a CI job that runs for each
merge request and checks whether the contribution does not break the rules, we merge request and checks whether the contribution does not break the rules, we
......
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