Skip to content

Commit 67fe2db

Browse files
committed
fix trailing whitespace check
<!-- ps-id: 839007f4-c7f9-4bc8-82e1-99e73a1e11f2 --> Signed-off-by: Ali Caglayan <[email protected]>
1 parent 0f73400 commit 67fe2db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/whitespace.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ jobs:
1616

1717
- name: Check for trailing whitespaces
1818
run: |
19-
if git grep --cached -n --ignore-case --perl-regexp '\s$' :; then
20-
echo "Trailing whitespaces found. Please remove with:\
21-
etc/fix_trailing_whitespace.sh"
19+
TRAILING_WHITESPACES=$(git grep -l -z -E '\s+$' | xargs -0 sed -n '/\s$/p')
20+
if [ -n "$TRAILING_WHITESPACES" ]; then
21+
echo "Trailing whitespaces found in the following files:"
22+
echo "$TRAILING_WHITESPACES"
23+
echo "Please remove them."
2224
exit 1
2325
fi
2426

0 commit comments

Comments
 (0)