Skip to content

Commit f10a05e

Browse files
Migrate from pre-commit to prek (#280)
* Migrate from pre-commit to prek * Update Poetry lock file
1 parent c36603f commit f10a05e

5 files changed

Lines changed: 750 additions & 774 deletions

File tree

.github/workflows/linting.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: 🚀 Run ruff formatter
3737
run: poetry run ruff format --check .
3838

39-
pre-commit-hooks:
40-
name: pre-commit-hooks
39+
prek-hooks:
40+
name: prek-hooks
4141
runs-on: ubuntu-latest
4242
steps:
4343
- name: ⤵️ Check out code from GitHub
@@ -57,31 +57,31 @@ jobs:
5757
- name: 🏗 Install Python dependencies
5858
run: poetry install --no-interaction
5959
- name: 🚀 Check Python AST
60-
run: poetry run pre-commit run check-ast --all-files
60+
run: poetry run prek run check-ast --all-files
6161
- name: 🚀 Check for case conflicts
62-
run: poetry run pre-commit run check-case-conflict --all-files
62+
run: poetry run prek run check-case-conflict --all-files
6363
- name: 🚀 Check docstring is first
64-
run: poetry run pre-commit run check-docstring-first --all-files
64+
run: poetry run prek run check-docstring-first --all-files
6565
- name: 🚀 Check that executables have shebangs
66-
run: poetry run pre-commit run check-executables-have-shebangs --all-files
66+
run: poetry run prek run check-executables-have-shebangs --all-files
6767
- name: 🚀 Check JSON files
68-
run: poetry run pre-commit run check-json --all-files
68+
run: poetry run prek run check-json --all-files
6969
- name: 🚀 Check for merge conflicts
70-
run: poetry run pre-commit run check-merge-conflict --all-files
70+
run: poetry run prek run check-merge-conflict --all-files
7171
- name: 🚀 Check for broken symlinks
72-
run: poetry run pre-commit run check-symlinks --all-files
72+
run: poetry run prek run check-symlinks --all-files
7373
- name: 🚀 Check TOML files
74-
run: poetry run pre-commit run check-toml --all-files
74+
run: poetry run prek run check-toml --all-files
7575
- name: 🚀 Check XML files
76-
run: poetry run pre-commit run check-xml --all-files
76+
run: poetry run prek run check-xml --all-files
7777
- name: 🚀 Check YAML files
78-
run: poetry run pre-commit run check-yaml --all-files
78+
run: poetry run prek run check-yaml --all-files
7979
- name: 🚀 Detect Private Keys
80-
run: poetry run pre-commit run detect-private-key --all-files
80+
run: poetry run prek run detect-private-key --all-files
8181
- name: 🚀 Check End of Files
82-
run: poetry run pre-commit run end-of-file-fixer --all-files
82+
run: poetry run prek run end-of-file-fixer --all-files
8383
- name: 🚀 Trim Trailing Whitespace
84-
run: poetry run pre-commit run trailing-whitespace --all-files
84+
run: poetry run prek run trailing-whitespace --all-files
8585

8686
yamllint:
8787
name: yamllint

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ repos:
88
types: [python]
99
entry: poetry run ruff check --fix
1010
require_serial: true
11-
stages: [pre-commit, pre-push, manual]
11+
stages: [commit, push, manual]
1212
- id: ruff-format
1313
name: 🐶 Ruff Formatter
1414
language: system
1515
types: [python]
1616
entry: poetry run ruff format
1717
require_serial: true
18-
stages: [pre-commit, pre-push, manual]
18+
stages: [commit, push, manual]
1919
- id: check-ast
2020
name: 🐍 Check Python AST
2121
language: system
@@ -35,7 +35,7 @@ repos:
3535
language: system
3636
types: [text, executable]
3737
entry: poetry run check-executables-have-shebangs
38-
stages: [pre-commit, pre-push, manual]
38+
stages: [commit, push, manual]
3939
- id: check-json
4040
name: { Check JSON files
4141
language: system
@@ -76,7 +76,7 @@ repos:
7676
language: system
7777
types: [text]
7878
entry: poetry run end-of-file-fixer
79-
stages: [pre-commit, pre-push, manual]
79+
stages: [commit, push, manual]
8080
- id: no-commit-to-branch
8181
name: 🛑 Don't commit to main branch
8282
language: system
@@ -102,7 +102,7 @@ repos:
102102
language: system
103103
types: [text]
104104
entry: poetry run trailing-whitespace-fixer
105-
stages: [pre-commit, pre-push, manual]
105+
stages: [commit, push, manual]
106106
- id: yamllint
107107
name: 🎗 Check YAML files with yamllint
108108
language: system

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ poetry install
136136
_Poetry creates by default an virtual environment where it installs all
137137
necessary pip packages_.
138138

139-
### Pre-commit
139+
### Prek
140140

141-
This repository uses the [pre-commit][pre-commit] framework, all changes
142-
are linted and tested with each commit. To setup the pre-commit check, run:
141+
This repository uses the [prek][prek] framework, all changes
142+
are linted and tested with each commit. To setup the prek check, run:
143143

144144
```bash
145-
poetry run pre-commit install
145+
poetry run prek install
146146
```
147147

148148
And to run all checks and tests manually, use the following command:
149149

150150
```bash
151-
poetry run pre-commit run --all-files
151+
poetry run prek run --all-files
152152
```
153153

154154
### Testing
@@ -210,4 +210,4 @@ SOFTWARE.
210210

211211
[poetry-install]: https://python-poetry.org/docs/#installation
212212
[poetry]: https://python-poetry.org
213-
[pre-commit]: https://pre-commit.com
213+
[prek]: https://github.com/j178/prek

0 commit comments

Comments
 (0)