diff options
author | Petri Lehtinen <petri@digip.org> | 2019-10-17 11:41:16 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2019-10-21 08:55:01 +0300 |
commit | 7c0297abe8f4fb4aafd642c3130628185dc78978 (patch) | |
tree | a2a248772ad821c6cde3c08fd1da33bebc53ebc4 | |
parent | 1a95a60f8093b709345ee6da8a954d1ebdfa5b7d (diff) | |
download | jansson-7c0297abe8f4fb4aafd642c3130628185dc78978.zip jansson-7c0297abe8f4fb4aafd642c3130628185dc78978.tar.gz jansson-7c0297abe8f4fb4aafd642c3130628185dc78978.tar.bz2 |
Support running a specific clang-format version in CI
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | scripts/clang-format-ci | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index a6c9054..df74eb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ script: - if [ "$JANSSON_BUILD_METHOD" = "cmake" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && ctest --output-on-failure; fi - if [ "$JANSSON_BUILD_METHOD" = "coverage" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && cmake --build . --target coveralls; fi - if [ "$JANSSON_BUILD_METHOD" = "fuzzer" ]; then ./test/ossfuzz/travisoss.sh; fi - - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-ci; fi + - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-ci 9; fi diff --git a/scripts/clang-format-ci b/scripts/clang-format-ci index 2051262..6854fc2 100755 --- a/scripts/clang-format-ci +++ b/scripts/clang-format-ci @@ -1,10 +1,15 @@ #!/bin/bash +clangformat="clang-format" +if [ -n "$1" ]; then + clangformat="clang-format-$1" +fi + errors=0 paths=$(find . -type f -a '(' -name '*.c' -o -name '*.h' ')') for path in $paths; do in=$(cat $path) - out=$(clang-format $path) + out=$($clangformat $path) if [ "$in" != "$out" ]; then diff -u -L $path -L "$path.formatted" $path - <<<$out |