From 994aca3d03f146e4d53cabc26f44e77333c380c0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 26 Jul 2024 21:32:12 +0200 Subject: [PATCH 1/3] Find typos with codespell and lint Python code with ruff --- .github/workflows/lint.yml | 13 +++++++++++++ pyproject.toml | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..640c7f2f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,13 @@ +name: lint +on: + push: + pull_request: + workflow_dispatch: +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pip install --user codespell[toml] ruff + - run: codespell + - run: ruff check --output-format=github diff --git a/pyproject.toml b/pyproject.toml index 3db8907f..05ee2b3a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,18 @@ requires = [ "setuptools >= 66.1" ] build-backend = "setuptools.build_meta" + +[tool.codespell] +ignore-words-list = "alltime,blong,ccompiler,fo,hel" +skip = "*.bak" + +[tool.ruff.lint] +select = [ + "E9", + "F63", + "F7", + "F82", +] +[tool.ruff.lint.per-file-ignores] +"src/cffi/verifier.py" = ["F821"] +"testing/*" = ["F821"] From a2a6431e1f3e682bd7b1d39b99a460a9adef9665 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 8 Feb 2025 15:03:41 +0100 Subject: [PATCH 2/3] test_re_python.py: Tix typo discovered by codespell --- testing/cffi1/test_re_python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/cffi1/test_re_python.py b/testing/cffi1/test_re_python.py index 91edd9b7..65369771 100644 --- a/testing/cffi1/test_re_python.py +++ b/testing/cffi1/test_re_python.py @@ -299,7 +299,7 @@ def test_rec_structs_1(): # from _rec_structs_1 import ffi # the following line used to raise TypeError - # unless preceeded by 'ffi.sizeof("struct C")'. + # unless preceded by 'ffi.sizeof("struct C")'. sz = ffi.sizeof("struct B") assert sz == ffi.sizeof("int *") From 9d100730103da226b65f58fa8d65338986b848c7 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 8 Feb 2025 15:06:49 +0100 Subject: [PATCH 3/3] - uses: codespell-project/actions-codespell@v2 & astral-sh/ruff-action@v3 --- .github/workflows/lint.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 640c7f2f..2219eb88 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,6 +8,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: pip install --user codespell[toml] ruff - - run: codespell - - run: ruff check --output-format=github + - uses: codespell-project/actions-codespell@v2 + - uses: astral-sh/ruff-action@v3