1
0
mirror of https://github.com/lightning/bolts.git synced 2024-11-19 01:50:03 +01:00

tools/spellcheck.sh: add --check option, add tests to travis.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-05-02 16:55:02 +09:30
parent 7ee9619c0c
commit c7092de08b
3 changed files with 38 additions and 2 deletions

View File

@ -1,4 +1,4 @@
personal_ws-1.1 en 259 personal_ws-1.1 en 260
secp secp
sig sig
unguessable unguessable
@ -139,6 +139,7 @@ hopEphemeralPubKeys
txid txid
Fn Fn
PublicKey PublicKey
encryptWithAD
liveness liveness
ie ie
shakin shakin

View File

@ -1,7 +1,13 @@
language: python language: python
addons:
apt:
packages:
- aspell-en
python: python:
- "3.4" - "3.4"
- "3.5" - "3.5"
- "3.6" - "3.6"
script: script:
- (set -e; for i in 0?-*.md; do echo "Extracting $i"; python3 tools/extract-formats.py --message-types --message-fields --check-alignment $i; done) - (set -e; for i in 0?-*.md; do echo "Extracting $i"; python3 tools/extract-formats.py --message-types --message-fields --check-alignment $i; done)
- tools/spellcheck.sh --check 0?*.md

View File

@ -5,6 +5,8 @@
# #
# ZmnSCPxj puts this script into the public domain. # ZmnSCPxj puts this script into the public domain.
set -e
# Check if dirname works. # Check if dirname works.
if (test_dir=`dirname -- /` && test "X"$test_dir = "X/") if (test_dir=`dirname -- /` && test "X"$test_dir = "X/")
then then
@ -39,7 +41,34 @@ echo X"$0" |
# repository. # repository.
homedir="$my_dir"/.. homedir="$my_dir"/..
if [ x"$1" = x"--check" ]; then
CHECK=1
shift
fi
for f for f
do do
aspell -l en_US --home-dir ${homedir} -c $f if [ -n "$CHECK" ]; then
# Eliminate the following:
# #-references eg. [Use of segwit](#use-of-segwit)
# quoted identifers eg. `htlc-id`
# field descriptions, eg. `* [num-htlcs*64:htlc-signature]'
# indented field names, eg. ' num_htlcs: 0'
# Short hex strings, eg '0x2bb038521914'
# long hex strings
# long base58 strings
WORDS=$(sed -e 's/\](#[-a-zA-Z0-9_]*)//g' \
-e 's/`[-a-zA-Z0-9_]*`//g' \
-e 's/\* \[[-_a-z0-9*]\+:[-_a-z0-9]\+\]//g' \
-e 's/0x[a-fA-F0-9]\+//g' \
-e 's/[a-fA-F0-9]\{20,\}//g' \
-e 's/^ .*_htlcs//g' \
-e 's/[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]\{20,\}//g' < $f | aspell -l en_US --home-dir ${homedir} list)
if [ -n "$WORDS" ]; then
echo Misspelled words in $f: $WORDS >&2
exit 1
fi
else
aspell -l en_US --home-dir ${homedir} -c $f
fi
done done