Add .clang-format

Most options are configured to keep most of the current style.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2021-07-19 09:40:22 -06:00
committed by Jeremy Soller
parent f21cc6d602
commit 04df6ae311
3 changed files with 152 additions and 0 deletions

16
scripts/clang-format.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only
FILES=($(git ls-files '*.[ch]'))
FMT_OPTS=(
"-style=file"
"--fallback-style=none"
"--Werror"
)
if [[ "$1" = "apply" ]]; then
clang-format "${FMT_OPTS[@]}" -i "${FILES[@]}"
else
clang-format "${FMT_OPTS[@]}" --dry-run "${FILES[@]}"
fi