diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..83ec5bfbe --- /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/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml new file mode 100644 index 000000000..cdc793892 --- /dev/null +++ b/.github/workflows/spell-check-task.yml @@ -0,0 +1,37 @@ +# 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 +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: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install Poetry + run: pip install poetry + + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Spell check + run: task general:check-spelling diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml deleted file mode 100644 index f4d484330..000000000 --- a/.github/workflows/spell-check.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Spell Check - -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" - -jobs: - spellcheck: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Install Poetry - run: pip install poetry - - - name: Install Taskfile - uses: arduino/setup-task@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - version: 3.x - - - name: Spell check - run: task check-spelling 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) diff --git a/Taskfile.yml b/Taskfile.yml index a44e8c77b..d9c6f2d0d 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 @@ -95,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: @@ -405,14 +402,18 @@ tasks: cmds: - npx prettier --write . - check-spelling: + # 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: + - task: poetry:install-deps cmds: - - poetry install --no-root - - poetry run codespell {{.CODESPELL_SKIP_OPTION}} {{.CODESPELL_IGNORE_WORDS_OPTION}} + - poetry run codespell - correct-spelling: + # 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: + - task: poetry:install-deps 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 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"