-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
136 lines (121 loc) · 3.16 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
136 lines (121 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# See https://pre-commit.com for more info
# See https://pre-commit.com/hooks.html for more hooks
# See https://www.youtube.com/watch?v=psjz6rwzMdk for how-to on pre-commits
repos:
# Fixes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v6.0.0"
hooks:
# File name fixes
- id: check-case-conflict
# Generic file fixes
- id: trailing-whitespace
- id: mixed-line-ending
- id: end-of-file-fixer
# File-type specific fixes
- id: check-json
- id: check-toml
- id: check-yaml
args:
- "--unsafe"
# Python-specific fixes
- id: debug-statements
language_version: python3
# Git fixes
- id: no-commit-to-branch
args:
- "--branch=main"
# Linter
- repo: https://github.com/psf/black
rev: "25.12.0"
hooks:
- id: black
language_version: python3.13
args:
- "--config=pyproject.toml"
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.20.0"
hooks:
- id: blacken-docs
additional_dependencies:
- "black>=23.3"
# Reorder Python imports
- repo: https://github.com/pycqa/isort
rev: "7.0.0"
hooks:
- id: isort
name: isort (python)
args:
- "--settings-file=pyproject.toml"
# Find any outdated syntax and replace with modern equivalents
- repo: https://github.com/asottile/pyupgrade
rev: "v3.21.2"
hooks:
- id: pyupgrade
name: Upgrade Python features
args:
- "--py39-plus"
# Check spelling
- repo: https://github.com/codespell-project/codespell
rev: "v2.4.1"
hooks:
- id: codespell
additional_dependencies:
- tomli
args:
- "--toml=pyproject.toml"
- "--skip=*.js,*.html,*.css,./docs/assets/coverage/*"
# Remove unused import statements
- repo: https://github.com/hadialqattan/pycln
rev: "v2.6.0"
hooks:
- id: pycln
args:
- "--all"
# Check uv configs
- repo: https://github.com/astral-sh/uv-pre-commit
rev: "0.9.18"
hooks:
- id: uv-lock
- id: uv-sync
# args:
# - "--all-groups"
# Check docstrings
- repo: https://github.com/data-science-extensions/docstring-format-checker
rev: "v1.9.0"
hooks:
- id: docstring-format-checker
name: Docstring Format Checker
args:
- "--config=pyproject.toml"
- "--output=list"
- "--check"
exclude: |
(?x)^(
src/tests/.*$|
src/utils/.*$
)
# Everything run locally
- repo: local
hooks:
# Run Pylint
- id: pylint
name: pylint
entry: pipenv run pylint
language: system
types: [python]
args:
- "--rcfile=pyproject.toml"
- "-rn" # Only display messages
- "-sn" # Don't display the score
- id: ty
name: ty-check
entry: uv run ty check ./src/toolbox_python
language: python
types: [python]
pass_filenames: true
exclude: |
(?x)^(
src/tests/.*$|
src/utils/.*$
)