spellcheck.sh 721 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # ensure dir
  4. cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/../.."
  5. PROJ_ROOT="$(pwd)"
  6. if [ -z "${1:-}" ]; then
  7. SCHEMA="${PROJ_ROOT}/_build/emqx/lib/emqx_dashboard/priv/www/static/schema.json"
  8. else
  9. SCHEMA="$(realpath "$1")"
  10. fi
  11. set +e
  12. docker run --rm -i --name spellcheck \
  13. -v "${PROJ_ROOT}"/scripts/spellcheck/dicts:/dicts \
  14. -v "$SCHEMA":/schema.json \
  15. ghcr.io/emqx/emqx-schema-validate:0.4.0 /schema.json
  16. result="$?"
  17. if [ "$result" -eq 0 ]; then
  18. echo "Spellcheck OK"
  19. exit 0
  20. fi
  21. echo "If this script finds a false positive (e.g. when it thinks that a protocol name is a typo),"
  22. echo "Add the word to dictionary in scripts/spellcheck/dicts"
  23. exit $result