Skip to content

Commit 455f010

Browse files
committed
chore(runformat): Explicitly check for uncrustify config file existence
1 parent 02d6227 commit 455f010

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runformat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cd "$SCRIPT_DIR"
1919

2020
UNCRUSTIFY_VERSION="0.80.1"
2121
UNCRUSTIFY="${UNCRUSTIFY-uncrustify}"
22+
UNCRUSTIFY_CONFIG="${SCRIPT_DIR}/.uncrustify.cfg"
2223

2324
err() { echo -e >&2 "ERROR: $@\n"; }
2425
die() { err $@; exit 1; }
@@ -36,9 +37,12 @@ if [[ "$DETECTED_VERSION" != "${UNCRUSTIFY_VERSION}" ]]; then
3637
die "Expected Uncrustify ${UNCRUSTIFY_VERSION}."
3738
fi
3839

40+
# Config check
41+
[[ -f "$UNCRUSTIFY_CONFIG" ]] || die "Uncrustify config not found at: $UNCRUSTIFY_CONFIG"
42+
3943
# Run formatter
4044
echo "Running formatter..."
41-
$UNCRUSTIFY -c .uncrustify.cfg -l CPP --no-backup --replace *.cpp *.h
45+
$UNCRUSTIFY -c "$UNCRUSTIFY_CONFIG" -l CPP --no-backup --replace *.cpp *.h
4246

4347
# Show diff and fail if changes exist
4448
echo "Checking for formatting changes..."

0 commit comments

Comments
 (0)