Skip to content
Permalink
Browse files

refine spellcheck progress output

  • Loading branch information
jef-n committed Aug 10, 2017
1 parent 7e90202 commit e6c7421c082ee50345078d3f2994ae7483865639
Showing with 4 additions and 2 deletions.
  1. +4 −2 scripts/spell_check/check_spelling.sh
@@ -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)
@@ -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

@@ -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

0 comments on commit e6c7421

Please sign in to comment.
You can’t perform that action at this time.