File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1717 - name : Check for trailing whitespaces
1818 run : |
1919 if git grep --cached -n --ignore-case --perl-regexp '\s$' :; then
20- echo "Trailing whitespaces found. Please remove with:\n\
21- git grep -l -z -E '\s+$' | xargs -0 sed -i 's/\s\+$//' "
20+ echo "Trailing whitespaces found. Please remove with:\
21+ etc/fix_trailing_whitespace.sh "
2222 exit 1
2323 fi
2424
2828 # Check if the file is a regular file and not in the .git directory
2929 if [ -f "$file" ] && [ "$(dirname "$file")" != ".git" ]; then
3030 if [ -n "$(tail -c 1 "$file")" ]; then
31- echo "File $file does not end with a newline. Adding newline..."
32- echo >> "$file "
33- git add "$file"
31+ echo "File $file does not end with a newline. Please fix with:\
32+ bash ./etc/fix_end_newlines.sh "
33+ exit 1
3434 fi
3535 fi
3636 done < <(git ls-files)
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # This command removes trailing whitespace from all files in the repository.
4+
5+ git grep -l -z -E ' \s+$' | xargs -0 sed -i ' s/\s\+$//'
You can’t perform that action at this time.
0 commit comments