Unverified Commit f1fa2753 authored by Andrey Garaev's avatar Andrey Garaev Committed by GitHub

Check pull requests source code formatting (#811)

parent 91ae7fc1
......@@ -31,6 +31,7 @@ _apt_pkgs: &_apt_pkgs
- 'gdb'
- 'lcov'
- 'cppcheck'
- 'clang-format-9'
_apt_srcs: &_apt_srcs
- 'ubuntu-toolchain-r-test'
......@@ -147,6 +148,12 @@ jobs:
- *_apt_pkgs
- ['g++-8']
before_install:
# Check source code formatting
- if [ $TRAVIS_PULL_REQUEST != "false" ]; then changed_src=$(git diff --name-only master...HEAD | egrep "\.(h|cc)$" | grep -v "include/pistache/thirdparty" || [ $? == 1 ]); fi
- if [ ! -z "$changed_src" ]; then git-clang-format-9 --quiet --binary $(which clang-format-9) --style llvm --diff master HEAD -- $changed_src > ./clang-format-diff; fi
- if [ -s ./clang-format-diff ]; then cat ./clang-format-diff && echo "Format source code according to LLVM style, please" && false; fi
install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
......
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