Add clang-format to ci

remotes/origin/HEAD
Konstantinos Sideris 7 years ago
parent f351b00075
commit 37ff1398b7
  1. 14
      .ci/format.sh
  2. 3
      .travis.yml
  3. 6
      Makefile

@ -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

@ -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

@ -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

Loading…
Cancel
Save