ci: Spellcheck documentation in the CI
This commit is contained in:
parent
5638bcb92b
commit
ef0da4fc70
|
@ -0,0 +1,25 @@
|
|||
name: Spellcheck
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Build slim packages]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
spellcheck_schema:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: emqx-24.1.5-4-ubuntu20.04
|
||||
path: .
|
||||
- name: Run spellcheck
|
||||
run: |
|
||||
tar zxf *.tar.gz
|
||||
find . -name schema.json -exec scripts/spellcheck \{\} \;
|
|
@ -1,246 +0,0 @@
|
|||
personal_ws-1.1 en 254
|
||||
ACL
|
||||
AES
|
||||
APIs
|
||||
BPAPI
|
||||
BSON
|
||||
Backplane
|
||||
CHACHA
|
||||
CLI
|
||||
CMD
|
||||
CN
|
||||
CONNACK
|
||||
CoAP
|
||||
Cygwin
|
||||
DES
|
||||
DN
|
||||
DNS
|
||||
DTLS
|
||||
DevOps
|
||||
Dialyzer
|
||||
Diffie
|
||||
EIP
|
||||
EMQ
|
||||
EPMD
|
||||
ERL
|
||||
ETS
|
||||
FIXME
|
||||
GCM
|
||||
Gw
|
||||
HOCON
|
||||
HTTPS
|
||||
JSON
|
||||
Kubernetes
|
||||
LwM
|
||||
MQTT
|
||||
Makefile
|
||||
MitM
|
||||
Multicast
|
||||
NIF
|
||||
OTP
|
||||
PEM
|
||||
PINGREQ
|
||||
PSK
|
||||
PUBREL
|
||||
QoS
|
||||
RESTful
|
||||
ROADMAP
|
||||
RSA
|
||||
Req
|
||||
Riak
|
||||
SHA
|
||||
SMS
|
||||
Struct
|
||||
TCP
|
||||
TLS
|
||||
TTL
|
||||
UDP
|
||||
URI
|
||||
XMLs
|
||||
acceptors
|
||||
ack
|
||||
acked
|
||||
addr
|
||||
api
|
||||
apiserver
|
||||
arg
|
||||
args
|
||||
async
|
||||
attr
|
||||
auth
|
||||
authenticator
|
||||
authenticators
|
||||
authn
|
||||
authz
|
||||
autoclean
|
||||
autoheal
|
||||
backend
|
||||
backends
|
||||
backoff
|
||||
backplane
|
||||
backtrace
|
||||
badarg
|
||||
badkey
|
||||
bcrypt
|
||||
behaviour
|
||||
bhvr
|
||||
boolean
|
||||
bytesize
|
||||
cacert
|
||||
cacertfile
|
||||
certfile
|
||||
ci
|
||||
clientid
|
||||
clientinfo
|
||||
cmake
|
||||
coap
|
||||
conf
|
||||
config
|
||||
configs
|
||||
confirmable
|
||||
conn
|
||||
connectionless
|
||||
cors
|
||||
cpu
|
||||
ctx
|
||||
customizable
|
||||
desc
|
||||
dir
|
||||
dns
|
||||
downlink
|
||||
downlink
|
||||
dtls
|
||||
ekka
|
||||
emqx
|
||||
enablement
|
||||
enqueue
|
||||
enqueued
|
||||
env
|
||||
eof
|
||||
epmd
|
||||
erl
|
||||
erts
|
||||
escript
|
||||
etcd
|
||||
eval
|
||||
exe
|
||||
executables
|
||||
exhook
|
||||
exproto
|
||||
extensibility
|
||||
formatter
|
||||
gRPC
|
||||
github
|
||||
goto
|
||||
grpcbox
|
||||
hocon
|
||||
hoconsc
|
||||
hostname
|
||||
hrl
|
||||
http
|
||||
https
|
||||
iface
|
||||
img
|
||||
impl
|
||||
inet
|
||||
inflight
|
||||
ini
|
||||
init
|
||||
ip
|
||||
ipv
|
||||
jenkins
|
||||
jq
|
||||
kb
|
||||
keepalive
|
||||
libcoap
|
||||
lifecycle
|
||||
localhost
|
||||
lwm
|
||||
mnesia
|
||||
mountpoint
|
||||
mqueue
|
||||
mria
|
||||
msg
|
||||
multicalls
|
||||
multicasts
|
||||
namespace
|
||||
natively
|
||||
nodelay
|
||||
nodetool
|
||||
nullable
|
||||
num
|
||||
os
|
||||
params
|
||||
peerhost
|
||||
peername
|
||||
perf
|
||||
powershell
|
||||
procmem
|
||||
procs
|
||||
progname
|
||||
prometheus
|
||||
proto
|
||||
ps
|
||||
psk
|
||||
pubsub
|
||||
qlen
|
||||
qmode
|
||||
qos
|
||||
quic
|
||||
ratelimit
|
||||
rebar
|
||||
recbuf
|
||||
relup
|
||||
replayq
|
||||
replicant
|
||||
repo
|
||||
reuseaddr
|
||||
rh
|
||||
rlog
|
||||
rootdir
|
||||
rpc
|
||||
runtime
|
||||
sc
|
||||
scalable
|
||||
seg
|
||||
setcookie
|
||||
sharded
|
||||
shareload
|
||||
sn
|
||||
sndbuf
|
||||
sockname
|
||||
sql
|
||||
src
|
||||
ssl
|
||||
statsd
|
||||
structs
|
||||
subprotocol
|
||||
subprotocols
|
||||
superset
|
||||
sys
|
||||
sysmem
|
||||
sysmon
|
||||
tcp
|
||||
ticktime
|
||||
tlog
|
||||
tls
|
||||
tlsv
|
||||
travis
|
||||
trie
|
||||
ttl
|
||||
typerefl
|
||||
udp
|
||||
uid
|
||||
unsub
|
||||
uplink
|
||||
url
|
||||
utc
|
||||
util
|
||||
ver
|
||||
vm
|
||||
vsn
|
||||
wakaama
|
||||
websocket
|
||||
ws
|
||||
wss
|
||||
xml
|
|
@ -1,72 +1,21 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC2015
|
||||
set -euo pipefail
|
||||
set -uo pipefail
|
||||
|
||||
aspell -v > /dev/null && [ "$#" -eq 1 ] || {
|
||||
echo "Usage:
|
||||
$(basename "$0") check
|
||||
or
|
||||
$(basename "$0") fix
|
||||
|
||||
Note: this script needs aspell to run"
|
||||
exit 1
|
||||
}
|
||||
|
||||
action=$1
|
||||
|
||||
dict_dir="$(git rev-parse --show-toplevel)/$(dirname "$0")/dict"
|
||||
echo "${dict_dir}"
|
||||
dict="${dict_dir}/.aspell.en"
|
||||
|
||||
export fail=0
|
||||
|
||||
aspellcmd() {
|
||||
local mode
|
||||
mode="${1}"
|
||||
shift
|
||||
aspell --mode "${mode}" --camel-case --add-filter html --add-html-skip code -p "$dict" "$@"
|
||||
}
|
||||
|
||||
check() {
|
||||
local mode file typos ntypos
|
||||
mode="$1"
|
||||
file="$2"
|
||||
|
||||
echo "!! Spellchecking ${file}"
|
||||
typos="$(mktemp)"
|
||||
echo "!! Typos:"
|
||||
aspellcmd "$mode" list < "$file" |
|
||||
sort -u |
|
||||
tee "$typos"
|
||||
ntypos="$(wc -l "$typos")"
|
||||
rm "$typos"
|
||||
[ "$ntypos" = 0 ] || export fail=1
|
||||
}
|
||||
|
||||
fix() {
|
||||
local mode file
|
||||
mode=$1
|
||||
file=$2
|
||||
|
||||
aspellcmd "$mode" check "$file"
|
||||
}
|
||||
|
||||
case $action in
|
||||
fix)
|
||||
for i in $(git ls-tree -r --name-only HEAD | grep -E '_schema.erl$'); do
|
||||
fix perl "$i"
|
||||
done
|
||||
# for i in $(git ls-tree -r --name-only HEAD | grep -E '.md$'); do
|
||||
# fix markdown $i
|
||||
# done
|
||||
;;
|
||||
*)
|
||||
check markdown _build/emqx/lib/emqx_dashboard/priv/www/static/config.md
|
||||
esac
|
||||
|
||||
|
||||
if [ $fail -eq 1 ]; then
|
||||
echo
|
||||
echo "!! Bad spelling in the documentation. Run script in fix mode to resolve problems."
|
||||
exit 1
|
||||
if [ -z "${1:-}" ]; then
|
||||
SCHEMA="_build/emqx/lib/emqx_dashboard/priv/www/static/schema.json"
|
||||
else
|
||||
SCHEMA="$1"
|
||||
fi
|
||||
|
||||
docker run -d --name langtool "ghcr.io/k32/emqx-schema-validate:0.1.0"
|
||||
|
||||
docker exec -i langtool ./emqx_schema_validate - < "${SCHEMA}"
|
||||
success="$?"
|
||||
|
||||
docker kill langtool || true
|
||||
docker rm langtool || true
|
||||
|
||||
echo "If this script finds a false positive (e.g. when it things that a protocol name is a typo),
|
||||
make a PR here: https://github.com/k32/emqx-schema-validate/blob/master/dict/en_spelling_additions.txt"
|
||||
|
||||
exit "$success"
|
||||
|
|
Loading…
Reference in New Issue