From ef663a04d5c32f1cb0849be7934f78d04d19604a Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:10:28 -0700 Subject: [PATCH 01/12] Use standardized filename for "Spell Check" workflow This is the template workflow filename, which is intended to serve as a unique identifier, and thus must be a bit more verbose. --- .github/workflows/{spell-check.yml => spell-check-task.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{spell-check.yml => spell-check-task.yml} (100%) diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check-task.yml similarity index 100% rename from .github/workflows/spell-check.yml rename to .github/workflows/spell-check-task.yml From e17a1a96ae31e55edd4e1b51fea8cc5dbc568983 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:34:19 -0700 Subject: [PATCH 02/12] Bump codespell dependency to ^2.1.0 --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index f9008c4cc..3f9633b0f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -60,7 +60,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "codespell" -version = "2.0.0" +version = "2.1.0" description = "Codespell" category = "dev" optional = false @@ -535,7 +535,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "34a7bca079636d788474fddc713c22b14e6830c62f1f5a0e09187d9f841ff4f2" +content-hash = "18f7f4afd0175c70942fe7396ae2d0d5bacac5872165d0be7d76e8c9a8034ef6" [metadata.files] appdirs = [ @@ -559,8 +559,8 @@ click = [ {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, ] codespell = [ - {file = "codespell-2.0.0-py3-none-any.whl", hash = "sha256:a10b8bbb9f678e4edff7877af1f654fdc9e27c205f952c3ddee2981ad02ec5f2"}, - {file = "codespell-2.0.0.tar.gz", hash = "sha256:dd9983e096b9f7ba89dd2d2466d1fc37231d060f19066331b9571341363c77b8"}, + {file = "codespell-2.1.0-py3-none-any.whl", hash = "sha256:b864c7d917316316ac24272ee992d7937c3519be4569209c5b60035ac5d569b5"}, + {file = "codespell-2.1.0.tar.gz", hash = "sha256:19d3fe5644fef3425777e66f225a8c82d39059dcfe9edb3349a8a2cf48383ee5"}, ] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, diff --git a/pyproject.toml b/pyproject.toml index 881ea0653..02caae41d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ mkdocs-material = "^7.1.8" [tool.poetry.dev-dependencies] black = "^21.7b0" -codespell = ">=1.17.1" +codespell = "^2.1.0" flake8 = "^3.9.2" pep8-naming = "^0.12.0" From 46ad090dfdb53357949195e36a001a2c6b06d86b Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:30:10 -0700 Subject: [PATCH 03/12] Use configuration file to configure spell checker tool Support for a configuration file was added in the 2.0.0 release of the codespell tool used for spell check in this repository. Use of this file allows consolidating all the configuration options in a single place, rather than having some in `etc/codespell-ignore-words-list.txt` and the others in the taskfile. --- .codespellrc | 9 +++++++++ Taskfile.yml | 7 ++----- etc/codespell-ignore-words-list.txt | 2 -- 3 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .codespellrc delete mode 100644 etc/codespell-ignore-words-list.txt diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..bcd28e23d --- /dev/null +++ b/.codespellrc @@ -0,0 +1,9 @@ +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = ot,propert +builtin = clear,informal,en-GB_to_en-US +check-filenames = +check-hidden = +skip = ./.git,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site diff --git a/Taskfile.yml b/Taskfile.yml index a44e8c77b..c1dcd50ce 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -34,9 +34,6 @@ vars: PRETTIER: prettier@2.1.2 - CODESPELL_SKIP_OPTION: '--skip "./.git,go.mod,go.sum,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site"' - CODESPELL_IGNORE_WORDS_OPTION: "--ignore-words ./etc/codespell-ignore-words-list.txt" - tasks: build: desc: Build the project @@ -409,10 +406,10 @@ tasks: desc: Check for commonly misspelled words cmds: - poetry install --no-root - - poetry run codespell {{.CODESPELL_SKIP_OPTION}} {{.CODESPELL_IGNORE_WORDS_OPTION}} + - poetry run codespell correct-spelling: desc: Correct commonly misspelled words where possible cmds: - poetry install --no-root - - poetry run codespell --write-changes {{.CODESPELL_SKIP_OPTION}} {{.CODESPELL_IGNORE_WORDS_OPTION}} + - poetry run codespell --write-changes diff --git a/etc/codespell-ignore-words-list.txt b/etc/codespell-ignore-words-list.txt deleted file mode 100644 index 914a05ed0..000000000 --- a/etc/codespell-ignore-words-list.txt +++ /dev/null @@ -1,2 +0,0 @@ -ot -propert From b3a40d582feda56548379e30e121d26dbc078cd8 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:38:40 -0700 Subject: [PATCH 04/12] Use standardized name for spell check tasks These are the naming conventions established in the standardized template project assets. --- .github/workflows/spell-check-task.yml | 2 +- Taskfile.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index f4d484330..62bd617b5 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -30,4 +30,4 @@ jobs: version: 3.x - name: Spell check - run: task check-spelling + run: task general:check-spelling diff --git a/Taskfile.yml b/Taskfile.yml index c1dcd50ce..ddf909547 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -92,7 +92,7 @@ tasks: - task: docs:check - task: config:check - task: general:check-formatting - - task: check-spelling + - task: general:check-spelling - task: shell:check-mode lint: @@ -402,13 +402,13 @@ tasks: cmds: - npx prettier --write . - check-spelling: + general:check-spelling: desc: Check for commonly misspelled words cmds: - poetry install --no-root - poetry run codespell - correct-spelling: + general:correct-spelling: desc: Correct commonly misspelled words where possible cmds: - poetry install --no-root From 5d5afef00cba785ef6ecfd69508bf5ced657efce Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:40:28 -0700 Subject: [PATCH 05/12] Use Python dependency installation task in spell check tasks A dedicated task has been added for installing the project's Python depencies, and this should be used throughout the taskfile in place of redundant direct commands. --- Taskfile.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index ddf909547..037f26dc9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -404,12 +404,14 @@ tasks: general:check-spelling: desc: Check for commonly misspelled words + deps: + - task: poetry:install-deps cmds: - - poetry install --no-root - poetry run codespell general:correct-spelling: desc: Correct commonly misspelled words where possible + deps: + - task: poetry:install-deps cmds: - - poetry install --no-root - poetry run codespell --write-changes From 9a8f796d6908cf2524e56252315b3603b4196e19 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:41:49 -0700 Subject: [PATCH 06/12] Use day name in "Spell Check" workflow's schedule trigger At the time it was written, there was some lack of support for the use of day name abreviations in the crontab definition for the `schedule` trigger of GitHub Actions workflows (perhaps it was the JSON schema?). Since that time, the issue was resolved. The crontab is easier to understand with the day name in place of day number. --- .github/workflows/spell-check-task.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index 62bd617b5..0b507edc6 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -4,8 +4,8 @@ on: pull_request: push: schedule: - # Run every Tuesday at 03:00 UTC to catch breakage caused by updates to the dictionary - - cron: "0 3 * * 2" + # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 8 * * TUE" jobs: spellcheck: From a825b26e2fa9266de3ced32d276d1fa87c8e14bf Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:42:41 -0700 Subject: [PATCH 07/12] Reorder triggers in "Spell Check" workflow No functional change, and neither is necessarily superior, but this is how it is in the "template", and so it must be here as well. --- .github/workflows/spell-check-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index 0b507edc6..389b8c2e6 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -1,8 +1,8 @@ name: Spell Check on: - pull_request: push: + pull_request: schedule: # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. - cron: "0 8 * * TUE" From dccef2b311a43da279d4953e2321b30807dbb681 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:43:33 -0700 Subject: [PATCH 08/12] Add manual events as "Spell Check" workflow triggers The `workflow_dispatch` event allows triggering the workflow via the GitHub web interface. This makes it easy to trigger an immediate workflow run after some relevant external change. The `repository_dispatch` event allows triggering workflows via the GitHub API. This might be useful for triggering an immediate check in multiple relevant repositories after an external change, or some automated process. Although we don't have any specific need for this event at the moment, the event has no impact on the workflow, so there is no reason against having it. It is the sort of thing that can end up being useful if it is already in consistently in place, but not worth setting up on demand, since the effort to set it up is greater than the effort to trigger all the workflows manually. --- .github/workflows/spell-check-task.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index 389b8c2e6..27f58db38 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -1,11 +1,14 @@ name: Spell Check +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: push: pull_request: schedule: # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: jobs: spellcheck: From b2d0d71d249088f1d5f3845c62a576fcaf8bdea6 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:43:58 -0700 Subject: [PATCH 09/12] Use standardized step names in "Spell Check" workflow These are the naming conventions established in the standardized template workflow. --- .github/workflows/spell-check-task.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index 27f58db38..2298a18a3 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v2 - name: Install Python @@ -26,7 +26,7 @@ jobs: - name: Install Poetry run: pip install poetry - - name: Install Taskfile + - name: Install Task uses: arduino/setup-task@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} From bf3560f824542e1bf1530b710cf164fa1bf66422 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:44:30 -0700 Subject: [PATCH 10/12] Add source URL comment to spell check assets This will make it easier for the maintainers to sync fixes and improvements in either direction between the upstream "template" assets and their installation in this repository. --- .github/workflows/spell-check-task.yml | 1 + Taskfile.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml index 2298a18a3..cdc793892 100644 --- a/.github/workflows/spell-check-task.yml +++ b/.github/workflows/spell-check-task.yml @@ -1,3 +1,4 @@ +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md name: Spell Check # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows diff --git a/Taskfile.yml b/Taskfile.yml index 037f26dc9..d9c6f2d0d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -402,6 +402,7 @@ tasks: cmds: - npx prettier --write . + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml general:check-spelling: desc: Check for commonly misspelled words deps: @@ -409,6 +410,7 @@ tasks: cmds: - poetry run codespell + # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml general:correct-spelling: desc: Correct commonly misspelled words where possible deps: From 0706d87f65924fb7f911d39df6d0a803013f0160 Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:45:05 -0700 Subject: [PATCH 11/12] Add "Spell Check" workflow badge to readme The badges provide a prominent indication of the repository's CI status at a glance. This may help to bring potential issues to the attention of the maintainers. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a1380d755..68811735c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ [![Publish Nightly Build status](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml) [![Check Python status](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml) [![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml) +[![Spell Check status](https://github.com/arduino/arduino-lint/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/spell-check-task.yml) [![Check Website status](https://github.com/arduino/arduino-lint/actions/workflows/check-mkdocs-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-mkdocs-task.yml) [![Deploy Website status](https://github.com/arduino/arduino-lint/actions/workflows/deploy-cobra-mkdocs-versioned-poetry.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/deploy-cobra-mkdocs-versioned-poetry.yml) [![Codecov](https://codecov.io/gh/arduino/arduino-lint/branch/main/graph/badge.svg?token=nprqPQMbdh)](https://codecov.io/gh/arduino/arduino-lint) From 9aba6178070b4587ee0eabb7e141b8ccaf51be4d Mon Sep 17 00:00:00 2001 From: per1234 Date: Wed, 4 Aug 2021 03:51:29 -0700 Subject: [PATCH 12/12] Exclude go.mod/go.sum files from repo's spell check task recursively The repository has a spell check as part of its infrastructure to catch typos before they can be introduced to the content. This check should not be done on generated files like `go.mod` and `go.sum`. The codespell spell check tool was already configured to skip those files in the root of the repository, but there is another module in `./docsgen`, and its module configuration files must also be excluded from the check. --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codespellrc b/.codespellrc index bcd28e23d..83ec5bfbe 100644 --- a/.codespellrc +++ b/.codespellrc @@ -6,4 +6,4 @@ ignore-words-list = ot,propert builtin = clear,informal,en-GB_to_en-US check-filenames = check-hidden = -skip = ./.git,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site +skip = ./.git,**/go.mod,**/go.sum,./package-lock.json,./poetry.lock,./yarn.lock,./arduino-lint,./arduino-lint.exe,./internal/rule/rulefunction/testdata/libraries/MisspelledSentenceParagraphValue/library.properties,./site