File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
1
env :
2
+ global :
3
+ - CLANG_FORMAT_VERSION=9
2
4
matrix :
3
5
- JANSSON_BUILD_METHOD=cmake JANSSON_CMAKE_OPTIONS="-DJANSSON_TEST_WITH_VALGRIND=ON" JANSSON_EXTRA_INSTALL="valgrind"
4
6
- JANSSON_BUILD_METHOD=autotools
5
7
- JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
6
8
- JANSSON_BUILD_METHOD=fuzzer
7
- - JANSSON_BUILD_METHOD=lint
9
+ - JANSSON_BUILD_METHOD=lint CLANG_FORMAT=clang-format-9
8
10
dist : bionic
9
11
language : c
10
12
compiler :
@@ -17,7 +19,7 @@ matrix:
17
19
- compiler : clang
18
20
env : JANSSON_BUILD_METHOD=fuzzer
19
21
- compiler : gcc
20
- env : JANSSON_BUILD_METHOD=lint
22
+ env : JANSSON_BUILD_METHOD=lint CLANG_FORMAT=clang-format-9
21
23
allow_failures :
22
24
- env : JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
23
25
install :
@@ -29,4 +31,4 @@ script:
29
31
- if [ "$JANSSON_BUILD_METHOD" = "cmake" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && ctest --output-on-failure; fi
30
32
- if [ "$JANSSON_BUILD_METHOD" = "coverage" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && cmake --build . --target coveralls; fi
31
33
- if [ "$JANSSON_BUILD_METHOD" = "fuzzer" ]; then ./test/ossfuzz/travisoss.sh; fi
32
- - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-check 9 ; fi
34
+ - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-check; fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- clangformat=" clang-format"
4
- if [ -n " $1 " ]; then
5
- clangformat=" clang-format-$1 "
6
- fi
3
+ CLANG_FORMAT=${CLANG_FORMAT:- clang-format}
4
+ CLANG_FORMAT_VERSION=${CLANG_FORMAT_VERSION:- }
7
5
8
- if ! type $clangformat > /dev/null; then
9
- # clang-format not found. If running tests, mark this test as
10
- # skipped.
6
+ if ! type $CLANG_FORMAT > /dev/null || \
7
+ ! $CLANG_FORMAT --version | grep -q " version ${CLANG_FORMAT_VERSION} " ; then
8
+ # If running tests, mark this test as skipped.
11
9
exit 77
12
10
fi
13
11
14
12
errors=0
15
- paths=$( find . -type f -a ' ( ' -name ' *.c ' -o -name ' *.h ' ' ) ' )
13
+ paths=$( git ls-files | grep ' \.[ch]$ ' )
16
14
for path in $paths ; do
17
15
in=$( cat $path )
18
- out=$( $clangformat $path )
16
+ out=$( $CLANG_FORMAT $path )
19
17
20
18
if [ " $in " != " $out " ]; then
21
19
diff -u -L $path -L " $path .formatted" $path - <<< $out
You can’t perform that action at this time.
0 commit comments