mirror of
https://github.com/codespell-project/codespell.git
synced 2025-08-06 18:24:41 +08:00
Use pre-commit to sort the dictionaries (#2973)
This commit is contained in:
12
Makefile
12
Makefile
@ -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 \
|
||||
|
Reference in New Issue
Block a user