1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

Meta: Update lint-{clang-format,shell-scripts}.sh to take a list of files

This should speed up pre-commit a bit as only files that are staged will
be processed, and clang-format and shellcheck are only invoked once, not
for every file. When no arguments are given (e.g. on CI), it still uses
'git ls-files'.
This commit is contained in:
Linus Groh 2020-12-27 15:34:06 +01:00 committed by Andreas Kling
parent a56b3cbf7c
commit 51bcfb5a44
4 changed files with 56 additions and 43 deletions

View file

@ -20,17 +20,17 @@ for cmd in \
Meta/lint-executable-resources.sh \
Meta/lint-ipc-ids.sh \
Meta/lint-shell-scripts.sh; do
echo "Running $cmd... "
if $cmd; then
echo -e "[${GREEN}OK${NC}]: ${cmd}"
echo "Running ${cmd}... "
if "${cmd}" "$@"; then
echo -e "[${GREEN}OK${NC}]: ${cmd}"
else
echo -e "[${RED}FAIL${NC}]: ${cmd}"
((FAILURES+=1))
echo -e "[${RED}FAIL${NC}]: ${cmd}"
((FAILURES+=1))
fi
done
echo "Running Meta/lint-clang-format.sh"
if Meta/lint-clang-format.sh --overwrite-inplace && git diff --exit-code; then
if Meta/lint-clang-format.sh --overwrite-inplace "$@" && git diff --exit-code; then
echo -e "[${GREEN}OK${NC}]: Meta/lint-clang-format.sh"
else
echo -e "[${RED}FAIL${NC}]: Meta/lint-clang-format.sh"