Skip to content

Commit 91ff647

Browse files
committed
add check_whitespace
1 parent 6b5cd17 commit 91ff647

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ ENV/
9494
# asv files
9595
benchmarks/html/
9696
benchmarks/results/
97-
.asv
97+
.asv

.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ authors check:
1414
- MISSING_AUTHORS=$(git shortlog -s HEAD | sed -e "s/^[0-9\t ]*//"| xargs -i sh -c 'grep -q "{}" AUTHORS.md || echo "{} missing from authors"')
1515
- if [ ! -z "$MISSING_AUTHORS" ]; then { echo $MISSING_AUTHORS; exit 1; }; fi
1616
allow_failure: true
17+
18+
check whitespace style:
19+
script: ./check_whitespace
20+
allow_failure: true

check_whitespace

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
! for f in $(git ls-files | grep -v \\.diff$); do
4+
file $f | grep -q ' text' || continue
5+
grep -q '[[:blank:]]$' $f && echo $f: trailing whitespace
6+
tail -n1 $f | read -r _ || echo $f: no newline at end of file
7+
tail -n1 $f | grep -q '^$' && echo $f: empty line at end of file
8+
done | grep . >&2
9+

0 commit comments

Comments
 (0)