2017-02-18 18:54:37 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This scrips runs clang-format recursively on all files under specified
|
|
|
|
# directories. Formatting configuration is defined in .clang-format.
|
|
|
|
|
2017-03-08 01:25:49 +08:00
|
|
|
# Format isn't enforced. Code reviewer has to ensure that a code format is
|
|
|
|
# valid and appropriate for the project.
|
|
|
|
|
2017-02-18 18:54:37 +08:00
|
|
|
clang_format="clang-format"
|
|
|
|
|
|
|
|
for directory in src tests
|
|
|
|
do
|
2017-03-08 01:25:49 +08:00
|
|
|
# If somebody wants to exclude a file from default formating here is a place
|
|
|
|
# for that
|
2017-02-18 18:54:37 +08:00
|
|
|
echo "formatting code under $directory/"
|
|
|
|
find "$directory" \( -name '*.hpp' -or -name '*.cpp' \) -print0 | xargs -0 "${clang_format}" -i
|
|
|
|
done
|