Commit 154300b6 authored by Felipe Lema's avatar Felipe Lema
Browse files

Merge branch 'clang-format-gitlab-ci' into clang-format-gitlab-ci-test

parents debb5dbb d04cce68
Pipeline #70884 passed with stage
in 1 minute and 11 seconds
#!/bin/bash -fxv
set -e
# download .clang-format into current directory
wget -c --output-document=.clang-format https://invent.kde.org/frameworks/extra-cmake-modules/raw/master/kde-modules/clang-format.cmake
git diff-tree --no-commit-id --name-only -r origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME -r $CI_COMMIT_SHA -- \
| grep -P '[.](c|cc|cpp|hpp|h)$' \
| xargs --no-run-if-empty --verbose clang-format-11 --dry-run -Werror
# 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.diff file, then do `apply format.diff`'
echo ''
git --no-pager diff -U0
exit 1
fi
exit 0
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