Skip to content

Commit a1da15f

Browse files
committed
Remove quoted text for spell checking
This removes any text enclosed in single or double quotes. Change-Id: Id65506bb0f4470ecf4ece58cb88f4c9f22d9afd7
1 parent 208ea8e commit a1da15f

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

scripts/aspell-pws

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,34 @@ changeid
301301
en
302302
msg
303303
cjk
304+
massif
305+
csapp
306+
cmu
307+
ele
308+
lima
309+
github
310+
ih
311+
it
312+
AddressSanitizer
313+
asan
314+
dbg
315+
dev
316+
dpkg
317+
apt
318+
siglongjmp
319+
sigsetjmp
320+
SIGABRT
321+
SIGALRM
322+
SIGBUS
323+
SIGFPE
324+
SIGHUP
325+
SIGILL
326+
SIGINT
327+
SIGKILL
328+
SIGPIPE
329+
SIGQUIT
330+
SIGSEGV
331+
SIGTERM
332+
SIGTRAP
333+
SIGUSR
334+
SIGWINCH

scripts/commit-msg.hook

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,11 @@ validate_commit_message() {
341341
add_warning 1 "Commit message appears to be written in Chinese: $MISSPELLED_WORDS"
342342
fi
343343

344-
# Use aspell to list misspelled words according to American English.
345-
MISSPELLED_WORDS=$(echo "$FULL_COMMIT_MSG" | $ASPELL --lang=en --list --home-dir=scripts --personal=aspell-pws)
344+
# Remove quoted text from FULL_COMMIT_MSG for spell checking.
345+
MSG_FOR_SPELLCHECK=$(echo "$FULL_COMMIT_MSG" | sed -E "s/(['\"][^'\"]*['\"])//g")
346+
347+
# Use aspell to list misspelled words according to American English, ignoring quoted text.
348+
MISSPELLED_WORDS=$(echo "$MSG_FOR_SPELLCHECK" | $ASPELL --lang=en --list --home-dir=scripts --personal=aspell-pws)
346349
if [ -n "$MISSPELLED_WORDS" ]; then
347350
add_warning 1 "Avoid using non-American English words"
348351
fi

0 commit comments

Comments
 (0)