Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refine spellcheck progress output
  • Loading branch information
jef-n committed Aug 10, 2017
1 parent 7e90202 commit e6c7421
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/spell_check/check_spelling.sh
Expand Up @@ -82,7 +82,7 @@ declare -A GLOBREP_IGNORE=()
ERRORFOUND=NO

for I in $(seq -f '%02g' 0 $(($SPLIT-1)) ) ; do
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && printf "Progress: %d/%d\n" $(( I + 1 )) $SPLIT
( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && printf "Progress: %d/%d\r" $(( I + 1 )) $SPLIT
SPELLFILE=spelling$I~

# if correction contains an uppercase letter and is the same as the error character wise, this means that the error is searched as a full word and case sensitive (not incorporated in a bigger one)
Expand Down Expand Up @@ -174,7 +174,7 @@ for I in $(seq -f '%02g' 0 $(($SPLIT-1)) ) ; do
# get correction from spelling.dat
CORRECTION=$(ag --nonumbers --case-sensitive "^${ERRORSMALLCASE}:" ${DIR}/spelling.dat | cut -d: -f2)

if [[ -z $CORRECTION ]]; then
if [[ -z "$CORRECTION" ]]; then
CORRECTION=$(perl -e "use strict; use warnings; while(<>) { chop; my(\$a,\$b) = split /:/; \$a = qr(\$a); if( my @matches = '${ERRORSMALLCASE}' =~ /^\$a\$/i ) { print sprintf(\$b, @matches); last; }}" ${DIR}/spelling.dat)
fi

Expand Down Expand Up @@ -290,6 +290,8 @@ for I in $(seq -f '%02g' 0 $(($SPLIT-1)) ) ; do
rm -f $SPELLFILE
done

( [[ "$INTERACTIVE" =~ YES ]] || [[ "$TRAVIS" =~ true ]] ) && echo

if [[ "$ERRORFOUND" =~ YES ]]; then
echo -e "\x1B[1msome errors have been found.\x1B[0m" >&2
exit 1
Expand Down

0 comments on commit e6c7421

Please sign in to comment.