From 3e493e80e2bb81c8c91385927b181c6c69cb5d04 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sat, 17 Jun 2023 22:39:12 -0400 Subject: [PATCH] Adding codespell checks and workflow (#287) --- .github/workflows/codespell.yml | 22 ++++++++++++++++++++++ pyproject.toml | 5 +++++ scripts/format.sh | 1 + scripts/lint.sh | 1 + tests/test_integration.py | 2 +- 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..3ebbf55 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,22 @@ +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/pyproject.toml b/pyproject.toml index 59a643e..4da8829 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ test = [ "black == 23.1.0", "mypy == 1.1.1", "types-requests == 2.28.11.17", + "codespell >= 2.2.5, < 3.0.0" ] dev = [ "ruff == 0.0.256", @@ -93,3 +94,7 @@ ignore = [ "C901", # too complex. "B008", # do not perform function calls in argument defaults. ] + +[tool.codespell] +skip = '.git,venv' +# ignore-words-list = '' diff --git a/scripts/format.sh b/scripts/format.sh index 10a6e22..06c765e 100644 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -4,3 +4,4 @@ set -x ruff sgpt tests scripts --fix black sgpt tests scripts isort sgpt tests scripts +codespell --write-changes diff --git a/scripts/lint.sh b/scripts/lint.sh index 3bc697d..041b61c 100644 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -7,3 +7,4 @@ mypy sgpt ruff sgpt tests scripts black sgpt tests --check isort sgpt tests scripts --check-only +codespell diff --git a/tests/test_integration.py b/tests/test_integration.py index ad73b54..1078668 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -446,6 +446,6 @@ class TestShellGpt(TestCase): } result = runner.invoke(app, self.get_arguments(**dict_arguments), input="d\n") assert result.exit_code == 0 - # Cant really test it since stdin in disable for --shell flag. + # Can't really test it since stdin in disable for --shell flag. # for word in ("prints", "hello", "console"): # assert word in result.stdout