Use pre-commit to sort the dictionaries (#2973)

This commit is contained in:
Kurt McKee
2023-07-31 19:13:39 -05:00
committed by GitHub
parent 11cba9d613
commit 9c580dff5f
4 changed files with 34 additions and 18 deletions

View File

@ -1,6 +1,4 @@
SORT_ARGS := -f -b
DICTIONARIES := codespell_lib/data/dictionary*.txt
DICTIONARIES := codespell_lib/data/dictionary*.txt codespell_lib/tests/data/*.wordlist
PHONY := all check check-dictionaries sort-dictionaries trim-dictionaries check-dist pytest pypi ruff clean
@ -14,10 +12,6 @@ codespell.1: codespell.1.include Makefile
check-dictionaries:
@for dictionary in ${DICTIONARIES}; do \
if ! LC_ALL=C sort ${SORT_ARGS} -c $$dictionary; then \
echo "Dictionary $$dictionary not sorted. Sort with 'make sort-dictionaries'"; \
exit 1; \
fi; \
if grep -E -n "^\s*$$|\s$$|^\s" $$dictionary; then \
echo "Dictionary $$dictionary contains leading/trailing whitespace and/or blank lines. Trim with 'make trim-dictionaries'"; \
exit 1; \
@ -31,9 +25,7 @@ check-dictionaries:
fi
sort-dictionaries:
@for dictionary in ${DICTIONARIES}; do \
LC_ALL=C sort ${SORT_ARGS} -u -o $$dictionary $$dictionary; \
done
pre-commit run --all-files file-contents-sorter
trim-dictionaries:
@for dictionary in ${DICTIONARIES}; do \