Files
system76-embedded-controller/scripts/clang-format.sh
Tim Crawford 7205f1a49e Add shellcheck lint
Run shellcheck [1] on the bash files.

[1]: https://www.shellcheck.net/

Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-01-18 13:52:14 -07:00

17 lines
333 B
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only
readarray -t FILES < <(git ls-files '*.c' '*.h')
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