Skip to content

Commit 02d6227

Browse files
committed
chore(runformat): Update uncrustify command line arguments to apply changes
Also display the diff and "fail" if there are differences
1 parent 2a18171 commit 02d6227

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

runformat

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@ if [[ "$DETECTED_VERSION" != "${UNCRUSTIFY_VERSION}" ]]; then
3636
die "Expected Uncrustify ${UNCRUSTIFY_VERSION}."
3737
fi
3838

39-
$UNCRUSTIFY -c .uncrustify.cfg --no-backup *.cpp *.h
39+
# Run formatter
40+
echo "Running formatter..."
41+
$UNCRUSTIFY -c .uncrustify.cfg -l CPP --no-backup --replace *.cpp *.h
42+
43+
# Show diff and fail if changes exist
44+
echo "Checking for formatting changes..."
45+
git diff --exit-code || {
46+
echo
47+
echo "Formatting changes were applied. Please review and commit."
48+
exit 1
49+
}
50+
51+
echo "Formatting is clean."

0 commit comments

Comments
 (0)