mirror of https://github.com/zulip/zulip.git
CI: Add Codespell linter.
This tool helps catch common typos in code and documentation, which is particularly useful for our many contributors who are not native English speakers. The config is based on the codespell that I ran in https://github.com/zulip/zulip/pull/18535.
This commit is contained in:
parent
5d5cf371d8
commit
a3a71487b0
|
@ -0,0 +1,18 @@
|
|||
te
|
||||
ans
|
||||
pullrequest
|
||||
ist
|
||||
cros
|
||||
wit
|
||||
nwe
|
||||
circularly
|
||||
ned
|
||||
ba
|
||||
ressemble
|
||||
ser
|
||||
sur
|
||||
hel
|
||||
fpr
|
||||
alls
|
||||
nd
|
||||
ot
|
|
@ -100,6 +100,11 @@ jobs:
|
|||
source tools/ci/activate-venv
|
||||
./tools/test-tools
|
||||
|
||||
- name: Run Codespell lint
|
||||
run: |
|
||||
source tools/ci/activate-venv
|
||||
./tools/run-codespell
|
||||
|
||||
- name: Run backend lint
|
||||
run: |
|
||||
source tools/ci/activate-venv
|
||||
|
|
|
@ -77,3 +77,6 @@ pyre-check
|
|||
|
||||
# For sorting versions when uploading releases
|
||||
natsort
|
||||
|
||||
# For spell check linter
|
||||
codespell
|
||||
|
|
|
@ -228,6 +228,10 @@ click-option-group==0.5.3 \
|
|||
--hash=sha256:9653a2297357335d7325a1827e71ac1245d91c97d959346a7decabd4a52d5354 \
|
||||
--hash=sha256:a6e924f3c46b657feb5b72679f7e930f8e5b224b766ab35c91ae4019b4e0615e
|
||||
# via semgrep
|
||||
codespell==2.1.0 \
|
||||
--hash=sha256:19d3fe5644fef3425777e66f225a8c82d39059dcfe9edb3349a8a2cf48383ee5 \
|
||||
--hash=sha256:b864c7d917316316ac24272ee992d7937c3519be4569209c5b60035ac5d569b5
|
||||
# via -r requirements/dev.in
|
||||
colorama==0.4.4 \
|
||||
--hash=sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b \
|
||||
--hash=sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Fix common misspellings in text files (config: .codespellignore)
|
||||
# Based on
|
||||
# https://github.com/bitcoin/bitcoin/blob/master/test/lint/lint-spelling.sh
|
||||
#
|
||||
# We plan to replace this script with the `tools/lint` system as soon as we can.
|
||||
|
||||
IGNORE_WORDS_FILE=.codespellignore
|
||||
FILES_TO_BE_CHECKED=$*
|
||||
if [ -z "$FILES_TO_BE_CHECKED" ]; then
|
||||
echo "No argument specified. Checking on the entire repo..."
|
||||
FILES_TO_BE_CHECKED="$(git ls-files -- ':(exclude)locale' ':(exclude)*fixtures*' ':(exclude)*.svg' ':(exclude)docs/translating' ':(exclude)yarn.lock' ':(exclude)docs/THIRDPARTY' ':(exclude)*postgresql.conf.template.erb' ':(exclude)tools/setup/emoji/emoji_names.py' ':(exclude)tools/setup/emoji/emoji_map.json' ':(exclude)zerver/management/data/unified_reactions.json')"
|
||||
else
|
||||
echo "Checking $FILES_TO_BE_CHECKED"
|
||||
fi
|
||||
mapfile -t FILES_TO_BE_CHECKED <<<"$FILES_TO_BE_CHECKED"
|
||||
|
||||
if ! codespell --ignore-words=$IGNORE_WORDS_FILE "${FILES_TO_BE_CHECKED[@]}"; then
|
||||
echo "You may check the files for typo again using ./tools/run-codespell <file 1> <file 2> ... <file n>"
|
||||
exit 1
|
||||
fi
|
|
@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 106
|
|||
# historical commits sharing the same major version, in which case a
|
||||
# minor version bump suffices.
|
||||
|
||||
PROVISION_VERSION = "164.2"
|
||||
PROVISION_VERSION = "164.3"
|
||||
|
|
Loading…
Reference in New Issue