ENH: bin/tools/git-find-non-ascii: find non-ASCII chars in source code

This commit is contained in:
Mark Olesen 2020-09-03 08:50:42 +02:00
parent 0e6df58c70
commit 916dcc85a5
2 changed files with 24 additions and 1 deletions

23
bin/tools/git-find-non-ascii Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
#------------------------------------------------------------------------------
# Script
# git-find-non-ascii
#
# Description
# Use git grep to find source files with non-ASCII characters.
# Use cached files for speed.
#
# C files: .c .h
# C++ files: .C .cc .cpp .cxx .H .hh .hpp .hxx
#
#------------------------------------------------------------------------------
git grep --cached --line-number -P '[\x00-\x08\x0E-\x1F\x80-\xFF]'
-- \
'*.[CHch]' \
'*.cc' \
'*.hh' \
'*.[ch]pp' \
'*.[ch]xx'
#------------------------------------------------------------------------------

View File

@ -8,6 +8,6 @@
#
#------------------------------------------------------------------------------
git grep --count -P '\s+$' -- $@
git grep --count -P '\s+$' -- "$@"
#------------------------------------------------------------------------------