From 538ab9d8cc5de6a530496014d1c53f76775322d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 2 Apr 2026 23:28:47 +0300 Subject: [PATCH] chore: switch from pre-commit to prek This is an interim change as we may end up revamping pre-commit checks further, but in the meantime, might just as well reap benefits of prek over pre-commit. To migrate existing pre-commit enabled setups: prek install --overwrite --hook-type pre-commit --hook-type commit-msg --- .github/requirements.txt | 2 +- .github/workflows/ci.yaml | 6 +++--- CONTRIBUTING.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/requirements.txt b/.github/requirements.txt index c97cac726e3..3e181e07fb7 100644 --- a/.github/requirements.txt +++ b/.github/requirements.txt @@ -1,3 +1,3 @@ -r ../test/requirements-dev.txt -pre-commit>=3.2.0 +prek>=0.3.8 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 508674521ca..07d25d17355 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,8 @@ jobs: test/requirements*.txt - uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 with: - path: ~/.cache/pre-commit - key: pre-commit-${{hashFiles('.pre-commit-config.yaml')}} + path: ~/.cache/prek + key: prek-${{hashFiles('.pre-commit-config.yaml')}} - name: Install dependencies run: | python3 -m venv venv # for venv-run @@ -34,7 +34,7 @@ jobs: - name: Run pre-commit checks run: | source venv/bin/activate - pre-commit run --color=always --all-files --show-diff-on-failure + prek run --color=always --all-files --show-diff-on-failure distcheck: runs-on: ubuntu-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef42bd74aa4..34f0b95434c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -226,14 +226,14 @@ Also, please bear the following coding guidelines in mind: python3 -m pip install -r test/requirements-dev.txt ``` -- Install pre-commit and set it up, see . +- Install prek and set it up, see . That'll run a bunch of linters and the like, the same as the bash-completion CI does. Running it locally and fixing found issues before commit/push/PR reduces some roundtrips with the review. After installing it, enable it for stages we use it with like: ```shell - pre-commit install --hook-type pre-commit --hook-type commit-msg + prek install --hook-type pre-commit --hook-type commit-msg ``` - File bugs, enhancement, and pull requests at GitHub,