File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /bin/bash
22#
33# check that all code complies w/ the clang-format specification
44#
77
88set -e # abort on error
99
10+ INCLUDE_DIRS=(core examples io tests)
1011
1112if [ $# -ne 1 ]; then
1213 echo " wrong number of arguments"
@@ -20,23 +21,19 @@ _binary=${CLANG_FORMAT_BINARY:-clang-format}
2021$_binary --version
2122
2223cd $1
23- find . \( -iname ' *.cpp' -or -iname ' *.hpp' -or -iname ' *.ipp' -or -iname ' *.cu' -or -iname ' *.cuh' -or -iname ' *.hip' -or -iname ' *.sycl' \) \
24- -and -not -path " ./*build*/*" \
25- -and -not -path " ./thirdparty/*" \
26- | xargs $_binary -i -style=file
27-
24+ $_binary -i -style=file $( find ${INCLUDE_DIRS} \( -iname ' *.cpp' -or -iname ' *.hpp' -or -iname ' *.ipp' -or -iname ' *.cu' -or -iname ' *.cuh' -or -iname ' *.hip' -or -iname ' *.sycl' \) )
2825
2926if ! [ -z $CI ] || ! [ -z $GITHUB_ACTIONS ]; then
3027 mkdir changed
31- for f in $( git diff --name-only) ; do
28+ for f in $( git diff --name-only -- ${INCLUDE_DIRS[@] /#/:/ } ) ; do
3229 cp --parents $f changed
3330 done
3431fi
3532
3633echo " clang-format done"
3734
3835set +e
39- git diff --exit-code --stat
36+ git diff --exit-code --stat -- ${INCLUDE_DIRS[@] /#/:/ }
4037result=$?
4138
4239if [ " $result " -eq " 128" ]; then
You can’t perform that action at this time.
0 commit comments