Debian Codegraph @

tools/format-all

raw
1 #!/usr/bin/env bash
2
3 # This command can be run by the user to clang-format everything.
4
5 PLATFORM=$(uname)
6 TOOLSPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
7 CLANGFORMAT="${TOOLSPATH}/${PLATFORM}/clang-format -style=file"
8
9 pushd "$TOOLSPATH/.." > /dev/null
10 CHECK_DIRS=()
11 for DIR in "include" "src" "tests/src" "tests/unit" "tools"; do [ -d "$TOOLSPATH/../$DIR" ] && CHECK_DIRS+=("$DIR") ; done
12 find ${CHECK_DIRS[@]} \
13 \( -name '*.cpp' -o -name '*.h' -o -name '*.cu' -o -name '*.cuh' -o -name '*.hpp' \) \
14 -not -name pugi* -not -name json.hpp -not -path '*/third-party/*' \
15 -print0 \
16 | xargs -n1 -0 ${CLANGFORMAT} -i
17 popd > /dev/null