diff options
-rwxr-xr-x | .ci/format.sh | 14 | ||||
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | Makefile | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/.ci/format.sh b/.ci/format.sh new file mode 100755 index 00000000..be15598a --- /dev/null +++ b/.ci/format.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Runs the Clang Formatter +# Return codes: +# - 1 there are files to be formatted +# - 0 everything looks fine + +set -o errexit +set -o pipefail +set -o nounset + +FILES=`find include src tests -type f -type f \( -iname "*.cc" -o -iname "*.h" \)` + +clang-format -i $FILES && git diff --exit-code diff --git a/.travis.yml b/.travis.yml index 92b45a88..b096b78e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ matrix: before_install: - if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/gtest.sh; fi install: - - if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 lmdb; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 lmdb clang-format; fi - if [ $TRAVIS_OS_NAME == osx ]; then export CMAKE_PREFIX_PATH=/usr/local/opt/qt5; fi - if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/install-deps.sh; fi before_script: @@ -26,3 +26,4 @@ before_script: script: - make -C build -j2 - if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/run-tests.sh; fi + - if [ $TRAVIS_OS_NAME == osx ]; then make lint; fi diff --git a/Makefile b/Makefile index 54ef1e16..ba116307 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,6 @@ APP_NAME = nheko MAC_DIST_DIR = dist/MacOS APP_TEMPLATE = $(MAC_DIST_DIR)/Nheko.app -SRC := $(shell find include src -type f -type f \( -iname "*.cc" -o -iname "*.h" \)) - - # Linux specific helpers debug: @cmake -DBUILD_TESTS=OFF -H. -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug @@ -38,8 +35,7 @@ run: @./build/nheko lint: - @clang-format -i $(SRC) - + @./.ci/format.sh clean: rm -rf build |