-
-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
104 lines (98 loc) · 3.2 KB
/
.pre-commit-config.yaml
File metadata and controls
104 lines (98 loc) · 3.2 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
repos:
- repo: local
hooks:
- id: poetry-check
name: Poetry Environment Check
entry: bash -c 'if [ -z "$GITHUB_ACTIONS" ]; then poetry install && poetry run pip list | grep -q django || (echo "Django not found in Poetry environment. Run poetry install." && exit 1); fi'
language: system
pass_filenames: false
always_run: true
verbose: true
# Critical formatting checks that must pass before tests run
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
stages: [pre-commit]
fail_fast: true
- id: end-of-file-fixer
stages: [pre-commit]
fail_fast: true
# Auto-fixing formatting hooks (won't fail the commit, will just fix issues)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: mixed-line-ending
args: [--fix=lf]
stages: [pre-commit]
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: ["--line-length=120"]
stages: [pre-commit]
fail_fast: true
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
args: ["--profile=black", "--line-length=120"]
stages: [pre-commit]
fail_fast: true
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.36.4
hooks:
- id: djlint-django
args: ["--reformat", "--max-line-length=120"]
files: '\.(html|djhtml)$'
stages: [pre-commit]
fail_fast: true
# Analysis hooks that need manual intervention
- repo: https://github.com/pycqa/flake8
rev: 7.1.2
hooks:
- id: flake8
args: ["--max-line-length=120"]
additional_dependencies: [flake8-django]
stages: [pre-commit, manual]
fail_fast: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
stages: [pre-commit, manual]
- id: check-added-large-files
stages: [pre-commit, manual]
- id: check-json
stages: [pre-commit, manual]
- id: check-toml
stages: [pre-commit, manual]
- id: check-xml
stages: [pre-commit, manual]
- id: check-merge-conflict
stages: [pre-commit, manual]
- id: detect-private-key
stages: [pre-commit, manual]
fail_fast: true
- repo: local
hooks:
- id: django-collectstatic
name: Django Collect Static
entry: bash -c 'if [ -z "$GITHUB_ACTIONS" ]; then cd "$(git rev-parse --show-toplevel)" && poetry run python manage.py collectstatic --noinput; fi'
language: system
types: [python]
pass_filenames: false
always_run: true
verbose: true
stages: [pre-commit]
- id: django-test
name: Django Tests
entry: bash -c 'if [ -z "$GITHUB_ACTIONS" ]; then cd "$(git rev-parse --show-toplevel)" && poetry run python manage.py test --verbosity=2 --timing --parallel=4 --failfast; fi'
language: system
types: [python]
pass_filenames: false
always_run: true
verbose: true
stages: [pre-commit]
default_stages: [pre-commit]
fail_fast: false