check-source (libcaca-0.99.beta19) | : | check-source (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
#!/bin/sh | #!/bin/sh | |||
export MAKEFLAGS="" | ||||
top_srcdir="$(make -s echo-topdir)" | ||||
# | # | |||
# Check that we have no tabs or trailing spaces in the source code | # Check that we have no tabs or trailing spaces in the source code | |||
# | # | |||
nfails=0 | nfails=0 | |||
nfiles=0 | nfiles=0 | |||
nlines=0 | nlines=0 | |||
for dir in $(make -s echo-dirs -C ..); do | for dir in $(make -s echo-dirs -C "${top_srcdir}"); do | |||
if [ ! -d "../$dir" ]; then continue; fi | if [ ! -d "${top_srcdir}/${dir}" ]; then continue; fi | |||
for x in $(make -s echo-sources -C ../$dir); do | for x in $(make -s echo-sources -C "${top_srcdir}/${dir}"); do | |||
case "$x" in | case "$x" in | |||
*.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|*.py|*.pl) | *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|*.py|*.pl) | |||
nfiles=$(($nfiles + 1)); | nfiles=$(($nfiles + 1)); | |||
nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;; | nlines=$(($nlines + `grep -c . "${top_srcdir}/${dir}/$x"`)) ;; | |||
*) | *) | |||
continue ;; | continue ;; | |||
esac | esac | |||
if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then | if grep '[[:space:]]$' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then | |||
echo "error: $dir/$x contains trailing spaces" | echo "error: ${dir}/$x contains trailing spaces" | |||
nfails=$(($nfails + 1)) | nfails=$(($nfails + 1)) | |||
fi | fi | |||
if grep ' ' "../$dir/$x" >/dev/null 2>&1; then | if grep ' ' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then | |||
echo "error: $dir/$x contains tabs" | echo "error: ${dir}/$x contains tabs" | |||
nfails=$(($nfails + 1)) | nfails=$(($nfails + 1)) | |||
fi | fi | |||
done | done | |||
done | done | |||
echo "$nfiles files, $nlines lines, $nfails errors in source code" | echo "$nfiles files, $nlines lines, $nfails errors in source code" | |||
if test "$nfails" != "0"; then | if test "$nfails" != "0"; then | |||
exit 1 | exit 1 | |||
fi | fi | |||
End of changes. 5 change blocks. | ||||
8 lines changed or deleted | 11 lines changed or added |