You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
999 B

  1. #!/bin/sh
  2. export MAKEFLAGS=""
  3. top_srcdir="$(make -s echo-topdir)"
  4. #
  5. # Check that we have no tabs or trailing spaces in the source code
  6. #
  7. nfails=0
  8. nfiles=0
  9. nlines=0
  10. for dir in $(make -s echo-dirs -C "${top_srcdir}"); do
  11. if [ ! -d "${top_srcdir}/${dir}" ]; then continue; fi
  12. for x in $(make -s echo-sources -C "${top_srcdir}/${dir}"); do
  13. case "$x" in
  14. *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|*.py|*.pl)
  15. nfiles=$(($nfiles + 1));
  16. nlines=$(($nlines + `grep -c . "${top_srcdir}/${dir}/$x"`)) ;;
  17. *)
  18. continue ;;
  19. esac
  20. if grep '[[:space:]]$' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then
  21. echo "error: ${dir}/$x contains trailing spaces"
  22. nfails=$(($nfails + 1))
  23. fi
  24. if grep ' ' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then
  25. echo "error: ${dir}/$x contains tabs"
  26. nfails=$(($nfails + 1))
  27. fi
  28. done
  29. done
  30. echo "$nfiles files, $nlines lines, $nfails errors in source code"
  31. if test "$nfails" != "0"; then
  32. exit 1
  33. fi
  34. exit 0