timescaledb/scripts/clang_format_all.sh
Erik Nordström ed30358f7b Exclude hidden and CMake directories when formatting code
The script for running clang-format on the source code now properly
excludes hidden directories and CMake directories from the source code
scan. Including these directories may otherwise break clang-format
because hidden directories are often used for IDE/tools caches (e.g.,
`cquery`) where the cache files have the same ending as the source
code.
2019-02-07 13:24:36 +01:00

10 lines
412 B
Bash
Executable File

#!/bin/bash
# we need to convert script dir to an absolute path
SCRIPT_DIR=$(cd $(dirname $0); pwd)
BASE_DIR=$(dirname $SCRIPT_DIR)
find ${BASE_DIR} \( -path "${BASE_DIR}/src/*" -or -path "${BASE_DIR}/test/*" -or -path "${BASE_DIR}/tsl/*" \) \
-and -not \( -path "*/.*" -or -path "*CMake*" \) \
-and \( -name '*.c' -or -name '*.h' \) -print | xargs ${SCRIPT_DIR}/clang_format_wrapper.sh -style=file -i