Add an optional "---fix" argument to format-checking script
This commit is contained in:
parent
221eb28815
commit
990233336f
|
@ -3,6 +3,11 @@
|
|||
# SPDX-FileCopyrightText: 2023 Citra Emulator Project
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
fix=false
|
||||
if [ "$1" == "--fix" ]; then
|
||||
fix=true
|
||||
fi
|
||||
|
||||
if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop \
|
||||
dist/*.svg dist/*.xml; then
|
||||
echo Trailing whitespace found, aborting
|
||||
|
@ -25,12 +30,16 @@ fi
|
|||
set +x
|
||||
|
||||
for f in $files_to_lint; do
|
||||
if [ "$fix" = true ]; then
|
||||
$CLANG_FORMAT -i "$f"
|
||||
else
|
||||
d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
|
||||
if ! [ -z "$d" ]; then
|
||||
echo "!!! $f not compliant to coding style, here is the fix:"
|
||||
echo "$d"
|
||||
fail=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
set -x
|
||||
|
|
Loading…
Reference in New Issue