From f7810403890c7024913595e1a6a15437281ed4a5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 28 Nov 2024 11:15:04 -0500 Subject: [PATCH] Add codespell support (config, workflow to detect/not fix) and make it fix few typos (#416) * Add github action to codespell main on push and PRs * Add rudimentary codespell config * [DATALAD RUNCMD] run codespell throughout fixing few left typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++ billiard/util.py | 2 +- setup.cfg | 7 ++++++ t/integration/tests/test_multiprocessing.py | 4 ++-- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..489bbccc --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within setup.cfg +--- +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@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/billiard/util.py b/billiard/util.py index 751959d8..4bca1184 100644 --- a/billiard/util.py +++ b/billiard/util.py @@ -219,7 +219,7 @@ def set_pdeathsig(sig): libc = ctypes.cdll.LoadLibrary("libc.so.6") libc.prctl(PR_SET_PDEATHSIG, ctypes.c_int(sig)) except Exception as e: - raise OSError("An error occured while setting pdeathsig") from e + raise OSError("An error occurred while setting pdeathsig") from e def _eintr_retry(func): ''' diff --git a/setup.cfg b/setup.cfg index 00fd1edf..0d11c113 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,3 +12,10 @@ ignore = D102,D104,D203,D105,D213 [metadata] license_file = LICENSE.txt + +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git* +check-hidden = true +# ignore-regex = +ignore-words-list = assertin diff --git a/t/integration/tests/test_multiprocessing.py b/t/integration/tests/test_multiprocessing.py index c5c39a5e..237d6649 100644 --- a/t/integration/tests/test_multiprocessing.py +++ b/t/integration/tests/test_multiprocessing.py @@ -22,7 +22,7 @@ from billiard._ext import _billiard except ImportError as exc: raise pytest.skip(exc) -# import threading after _billiard to raise a more revelant error +# import threading after _billiard to raise a more relevant error # message: "No module named _billiard". _billiard is not compiled # without thread support. import threading @@ -750,7 +750,7 @@ def test_event(self): event = self.Event() wait = TimingWrapper(event.wait) - # Removed temporaily, due to API shear, this does not + # Removed temporarily, due to API shear, this does not # work with threading._Event objects. is_set == isSet self.assertEqual(event.is_set(), False)