Skip to content

chore: adding clang-format checks #2

chore: adding clang-format checks

chore: adding clang-format checks #2

Workflow file for this run

#!/bin/bash
#
# check that all code complies w/ the clang-format specification
#
# if all is well, returns w/o errors and does not print anything.
# otherwise, return an error and print offending changes
set -e # abort on error
INCLUDE_DIRS=("core data meta tests web")
if [ $# -ne 1 ]; then
echo "wrong number of arguments"
echo ""
echo "usage: check_format <DIR>"

Check failure on line 15 in .github/workflows/checks.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/checks.yml

Invalid workflow file

You have an error in your yaml syntax on line 15
exit 1
fi
_binary=${CLANG_FORMAT_BINARY:-clang-format}
$_binary --version
cd $1
$_binary -i -style=file $(find ${INCLUDE_DIRS} \( -iname '*.cpp' -or -iname '*.hpp' -or -iname '*.ipp' -or -iname '*.inl' -or -iname '*.cu' -or -iname '*.cuh' -or -iname '*.hip' -or -iname '*.sycl' \))
if ! [ -z $CI ] || ! [ -z $GITHUB_ACTIONS ]; then
mkdir changed
for f in $(git diff --name-only -- ${INCLUDE_DIRS[@]/#/:/}); do
cp --parents $f changed
done
fi
echo "clang-format done"
set +e
git diff --exit-code --stat -- ${INCLUDE_DIRS[@]/#/:/}
result=$?
if [ "$result" -eq "128" ]; then
echo "Format was successfully applied"
echo "Could not create summary of affected files"
echo "Are you in a submodule?"
fi
exit $result