Last change
on this file since 4352 was
4352,
checked in by Sam Hocevar, 13 years ago
|
Make the check-source test more generic.
|
-
Property svn:executable set to
*
|
File size:
856 bytes
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | |
---|
3 | # |
---|
4 | # Check that we have no tabs or trailing spaces in the source code |
---|
5 | # |
---|
6 | nfails=0 |
---|
7 | nfiles=0 |
---|
8 | nlines=0 |
---|
9 | for dir in $(make -s echo-dirs -C ..); do |
---|
10 | if [ ! -d "../$dir" ]; then continue; fi |
---|
11 | for x in $(make -s echo-sources -C ../$dir); do |
---|
12 | case "$x" in |
---|
13 | *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl) |
---|
14 | nfiles=$(($nfiles + 1)); |
---|
15 | nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;; |
---|
16 | *) |
---|
17 | continue ;; |
---|
18 | esac |
---|
19 | if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then |
---|
20 | echo "error: $dir/$x contains trailing spaces" |
---|
21 | nfails=$(($nfails + 1)) |
---|
22 | fi |
---|
23 | if grep ' ' "../$dir/$x" >/dev/null 2>&1; then |
---|
24 | echo "error: $dir/$x contains tabs" |
---|
25 | nfails=$(($nfails + 1)) |
---|
26 | fi |
---|
27 | done |
---|
28 | done |
---|
29 | |
---|
30 | echo "$nfiles files, $nlines lines, $nfails errors in source code" |
---|
31 | |
---|
32 | if test "$nfails" != "0"; then |
---|
33 | exit 1 |
---|
34 | fi |
---|
35 | |
---|
36 | exit 0 |
---|
37 | |
---|
Note: See
TracBrowser
for help on using the repository browser.