Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

CI: Add Codespell linter.

rhta3a71487b0a5
diff --git a/.codespellignore b/.codespellignore
new file mode 100644
index 00000000000..77acea2691d
--- /dev/null
+++ b/.codespellignore
@@ -0,0 +1,18 @@
+te
+ans
+pullrequest
+ist
+cros
+wit
+nwe
+circularly
+ned
+ba
+ressemble
+ser
+sur
+hel
+fpr
+alls
+nd
+ot
diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml
index 893804bb50f..d054cf68f6c 100644
--- a/.github/workflows/zulip-ci.yml
+++ b/.github/workflows/zulip-ci.yml
@@ -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
diff --git a/requirements/dev.in b/requirements/dev.in
index 374e74073ff..96ebc568f5f 100644
--- a/requirements/dev.in
+++ b/requirements/dev.in
@@ -77,3 +77,6 @@ pyre-check
# For sorting versions when uploading releases
natsort
+
+# For spell check linter
+codespell
diff --git a/requirements/dev.txt b/requirements/dev.txt
index d43dda59bb5..bcab0ba6651 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -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
diff --git a/tools/run-codespell b/tools/run-codespell
new file mode 100755
index 00000000000..5c09a29e4d6
--- /dev/null
+++ b/tools/run-codespell
@@ -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
diff --git a/version.py b/version.py
index 37d425bca1d..9b05738002c 100644
--- a/version.py
+++ b/version.py
@@ -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"