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.
 
 
 
 
 
 

38 regels
856 B

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