Commit b880f66c authored by Felipe Lema's avatar Felipe Lema Committed by Dmitry Kazakov
Browse files

Add clang-format to CI

Add `clang-format` to Continuous Integration so merge request are
ensured to comply with
[KDE's code convention](

## Test Plan

I believe everything's already been setup for for gitlab CI
(formal docs [here](
parent 8c15dc3e
#!/bin/bash -fxv
# stop running script if a command fails
set -e
# ensure `clang-format` command points to `clang-format-11`
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-11 30
update-alternatives --set clang-format /usr/bin/clang-format-11
# download .clang-format into current directory
wget -c --output-document=.clang-format
# format source code inline
git clang-format-11 $(git merge-base origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME $CI_COMMIT_SHA)
# if files were modified, then print the diff modified that would make the proper format
if ! git diff-index --quiet HEAD; then
echo '*** Suggested changes to comply with KDE code conventions are below'
echo 'You can copy below this empty line, save the content to a format.patch file, then do `patch < format.patch`'
echo ''
git --no-pager diff -U0
exit 1
exit 0
DEBIAN_FRONTEND: "noninteractive"
stage: build
image: debian:testing
- merge_requests
- master
- apt-get update
- apt-get install --yes --no-install-recommends wget ca-certificates git clang-format-11
- update-ca-certificates
- ./.gitlab-ci.script
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment