1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 08:13:50 +02:00
cdt/releng/scripts/do_remove_trailing_whitespace.sh
Jonah Graham 6233337560 [releng] Split up check_code_cleanliness script
As more checks have been added it has gotten a little unweildy.

The new script "do_all_code_cleanups.sh" now does most of the code
formatting checks.

Change-Id: I65fd888c88e1d7e470ed5621cee18ff3bf6680b4
2020-08-30 20:09:50 -04:00

14 lines
443 B
Bash
Executable file

#!/bin/bash
set -e
##
# Remove trailing whitespace.
# The .gitattributes is used as a filter to identify files to check. Patters with
# this "# check trailing whitespace" on the line before are checked
##
awk '/# remove trailing whitespace/{getline; print $1}' .gitattributes |
while read i ; do
echo "Removing trailing whitespace on $i files"
git ls-files -- "$i" | xargs --no-run-if-empty sed -i 's/[ \t]*$//'
done