-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
76 lines (69 loc) · 2.27 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
76 lines (69 loc) · 2.27 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
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=auto]
- id: check-merge-conflict
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-ast
- id: debug-statements
- id: detect-private-key
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --indent=2]
- id: check-illegal-windows-names
- id: check-case-conflict
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: requirements-txt-fixer
- id: no-commit-to-branch
args: [--branch, main]
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: Sort imports with isort
files: ^(sygra|tests)/.*\.py$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
name: Lint with Ruff
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
files: ^(sygra|tests)/
- repo: local
hooks:
- id: mypy-uv
name: Type check with mypy
entry: uv run mypy sygra
language: system
pass_filenames: false
stages: [ pre-commit ]
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
name: Format code with Black
files: ^(sygra|tests)/.*\.py$
- repo: local
hooks:
- id: version-check
name: Validate __version__ is valid PEP 440
entry: python3 -c "import re, sys; content=open('sygra/__init__.py').read(); m=re.search(r'__version__\s*=\s*\"(\d+\.\d+\.\d+(?:\.(?:post|dev)\d+|(?:a|b|rc)\d+)?)\"', content); sys.exit(0) if m else (print('[ERROR] Invalid __version__ in sygra/__init__.py. Must be PEP 440 (e.g. X.Y.Z, X.Y.Z.postN)') or sys.exit(1))"
language: system
files: ^sygra/__init__\.py$
pass_filenames: false
- id: pytest
name: Run tests with pytest
entry: uv run pytest -q tests
language: system
pass_filenames: false
stages: [ pre-commit ]