Skip to content

Commit d42bb7e

Browse files
committed
Add CI workflow to check for commonly misspelled words
On every push, pull request, and periodically, use codespell to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the `ignore-words-list` field of `.codespellrc`. Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces.
1 parent 3d1d8ba commit d42bb7e

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

Diff for: .codespellrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = ,
6+
skip = ./.git,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =

Diff for: .github/workflows/spell-check-task.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md
2+
name: Spell Check
3+
4+
env:
5+
# See: https://github.com/actions/setup-python/tree/v2#available-versions-of-python
6+
PYTHON_VERSION: "3.9"
7+
8+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
9+
on:
10+
push:
11+
pull_request:
12+
schedule:
13+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
14+
- cron: "0 8 * * TUE"
15+
workflow_dispatch:
16+
repository_dispatch:
17+
18+
jobs:
19+
spellcheck:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Install Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ env.PYTHON_VERSION }}
30+
31+
- name: Install Poetry
32+
run: pip install poetry
33+
34+
- name: Install Task
35+
uses: arduino/setup-task@v1
36+
with:
37+
repo-token: ${{ secrets.GITHUB_TOKEN }}
38+
version: 3.x
39+
40+
- name: Spell check
41+
run: task general:check-spelling

Diff for: Taskfile.yml

+16
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ tasks:
4545
cmds:
4646
- npx prettier --write .
4747

48+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
49+
general:check-spelling:
50+
desc: Check for commonly misspelled words
51+
deps:
52+
- task: poetry:install-deps
53+
cmds:
54+
- poetry run codespell
55+
56+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
57+
general:correct-spelling:
58+
desc: Correct commonly misspelled words where possible
59+
deps:
60+
- task: poetry:install-deps
61+
cmds:
62+
- poetry run codespell --write-changes
63+
4864
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
4965
poetry:install-deps:
5066
desc: Install dependencies managed by Poetry

Diff for: poetry.lock

+17-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ python = "^3.9"
99

1010
[tool.poetry.dev-dependencies]
1111
yamllint = "^1.26.3"
12+
codespell = "^2.1.0"
1213

1314
[build-system]
1415
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)