Skip to content

Commit 59f2861

Browse files
committed
Replace pre-commit with prek
1 parent d19f9dd commit 59f2861

File tree

5 files changed

+74
-109
lines changed

5 files changed

+74
-109
lines changed

.pre-commit-config.yaml

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,72 +6,82 @@ repos:
66
rev: v6.0.0
77
hooks:
88
- id: check-added-large-files
9+
priority: 0
910
- id: check-ast
11+
priority: 0
1012
- id: check-merge-conflict
13+
priority: 0
1114
- id: debug-statements
15+
priority: 0
1216
- id: detect-private-key
17+
priority: 0
1318
- id: end-of-file-fixer
1419
types: [python]
20+
priority: 1
1521
- id: fix-byte-order-marker
22+
priority: 2
1623
- id: mixed-line-ending
1724
args: [--fix=lf]
1825
types: [python]
26+
priority: 3
1927
- id: trailing-whitespace
28+
priority: 4
2029

2130
- repo: https://github.com/pre-commit/pygrep-hooks
2231
rev: v1.10.0
2332
hooks:
2433
- id: python-check-blanket-noqa
34+
priority: 0
2535
- id: python-check-mock-methods
36+
priority: 0
2637
- id: python-no-eval
38+
priority: 0
2739
- id: python-no-log-warn
40+
priority: 0
2841
- id: python-use-type-annotations
42+
priority: 0
2943
- id: text-unicode-replacement-char
44+
priority: 0
45+
46+
- repo: https://github.com/IamTheFij/docker-pre-commit
47+
rev: v3.0.1
48+
hooks:
49+
- id: docker-compose-check
50+
priority: 0
3051

3152
- repo: https://github.com/Lucas-C/pre-commit-hooks
3253
rev: v1.5.5
3354
hooks:
3455
- id: forbid-tabs
56+
priority: 0
3557
- id: remove-tabs
3658
args: [--whitespaces-count, '2']
59+
priority: 5
3760
- id: chmod
3861
args: ['644']
3962
exclude_types: [shell]
4063
exclude: ^(.*__main__\.py|data_rentgen/server/scripts/.*\.py|data_rentgen/db/scripts/[^/]+\.py|data_rentgen/http2kafka/scripts/.*\.py)$
64+
priority: 6
4165
- id: chmod
4266
args: ['755']
4367
files: ^(.*__main__\.py|data_rentgen/server/scripts/.*\.py|data_rentgen/db/scripts/[^/]+\.py|data_rentgen/http2kafka/scripts/.*\.py)$
68+
priority: 6
4469
- id: insert-license
45-
files: .*\.py$
70+
types: [python]
4671
exclude: ^(data_rentgen/dependencies/stub.py|docs/.*\.py|tests/.*\.py)$
4772
args:
4873
- --license-filepath
4974
- .spdx-license-header.txt
5075
- --allow-past-years
5176
- --no-extra-eol
52-
53-
- repo: https://github.com/asottile/add-trailing-comma
54-
rev: v4.0.0
55-
hooks:
56-
- id: add-trailing-comma
57-
58-
- repo: https://github.com/astral-sh/ruff-pre-commit
59-
rev: v0.14.10
60-
hooks:
61-
- id: ruff-check
62-
args: [--fix]
63-
- id: ruff-format
64-
65-
- repo: https://github.com/IamTheFij/docker-pre-commit
66-
rev: v3.0.1
67-
hooks:
68-
- id: docker-compose-check
77+
priority: 7
6978

7079
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
7180
rev: v2.15.0
7281
hooks:
7382
- id: pretty-format-yaml
7483
args: [--autofix, --indent, '2', --offset, '2']
84+
priority: 7
7585

7686
- repo: https://github.com/codespell-project/codespell
7787
rev: v2.4.1
@@ -80,30 +90,43 @@ repos:
8090
args: [-w]
8191
additional_dependencies:
8292
- tomli
93+
exclude: .*\.svg
94+
priority: 8
8395

8496
- repo: https://github.com/astral-sh/uv-pre-commit
8597
rev: 0.9.18
8698
hooks:
8799
- id: uv-lock
100+
priority: 9
101+
102+
- repo: https://github.com/astral-sh/ruff-pre-commit
103+
rev: v0.14.10
104+
hooks:
105+
- id: ruff-format
106+
priority: 9
107+
- id: ruff-check
108+
args: [--fix]
109+
priority: 10
88110

89111
- repo: local
90112
hooks:
91113
- id: mypy
92114
name: mypy
93115
entry: mypy ./data_rentgen --config-file ./pyproject.toml
94116
language: python
95-
types: [python]
96117
require_serial: true
97118
pass_filenames: false
119+
priority: 10
98120

99121
- repo: meta
100122
hooks:
101123
- id: check-hooks-apply
124+
priority: 0
102125
- id: check-useless-excludes
126+
priority: 0
103127

104128
ci:
105129
skip:
106-
- mypy # checked with Github Actions
107-
- docker-compose-check # cannot run on pre-commit.ci
108-
- chmod # failing in pre-commit.ci
109-
- uv-lock # failing in pre-commit.ci in cause of https://github.com/astral-sh/uv/issues/10167
130+
- mypy # checked with Github Actions
131+
- chmod # failing in pre-commit.ci
132+
- docker-compose-check # cannot run on pre-commit.ci

CONTRIBUTING.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ Enable pre-commit hooks
7878
`pre-commit <https://pre-commit.com/>`_ hooks allows to validate & fix repository content before making new commit.
7979
It allows to run linters, formatters, fix file permissions and so on. If something is wrong, changes cannot be committed.
8080

81-
Firstly, install pre-commit hooks:
81+
Firstly, install `prek <https://prek.j178.dev/>`_:
8282

8383
.. code:: bash
8484
85-
pre-commit install --install-hooks
85+
prek install --install-hooks
8686
8787
Ant then test hooks run:
8888

8989
.. code:: bash
9090
91-
pre-commit run
91+
prek run
9292
9393
How to
9494
------

data_rentgen/db/migrations/alembic.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version_path_separator = os
88
hooks=pre-commit
99

1010
pre-commit.type = console_scripts
11-
pre-commit.entrypoint = pre-commit
11+
pre-commit.entrypoint = prek
1212
pre-commit.options = run --files REVISION_SCRIPT_FILENAME
1313
pre-commit.cwd = %(here)s
1414

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ test = [
113113
"gevent~=25.9.1",
114114
]
115115
dev = [
116-
"pre-commit~=4.5.0",
116+
"prek~=0.2.25",
117117
"mypy~=1.19.0",
118118
"sqlalchemy[mypy]~=2.0.44",
119119
"types-pyyaml~=6.0.12",

uv.lock

Lines changed: 23 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)