-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
100 lines (88 loc) · 2.93 KB
/
.pre-commit-config.yaml
File metadata and controls
100 lines (88 loc) · 2.93 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
--- # ← document start (keeps yamllint happy)
minimum_pre_commit_version: "3.6.0"
default_language_version:
python: python3.11 # match your Poetry env (3.11.x)
ci:
autofix: true # rewrite files, then fail so diff is visible
skip: [shellcheck, pytest] # pre-commit.ci lacks Docker and Poetry for these hooks
fail_fast: true
default_stages: [pre-commit, pre-push] # was [commit, push]
repos:
# ---------------------------------------------------- House-keeping hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: debug-statements
- id: detect-private-key
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ["--maxkb", "500"]
# ----------------------------------------------------------- YAML linter
- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
files: "\\.(ya?ml)$"
args:
- "-d"
- "{extends: default, rules: {line-length: {max: 120}}}"
# ------------------------------------------- Shell formatting & linting
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.12.0-2
hooks:
- id: shfmt
args: ["-i", "2", "-sr", "-ci"]
files: "^scripts/.*\\.sh$" # only format our scripts/
exclude: "^docker/" # avoid parsing docker/orchestrate.sh for now
- repo: local
hooks:
- id: shellcheck
name: ShellCheck (system)
entry: shellcheck --severity warning
language: system
files: "^scripts/.*\\.sh$"
exclude: "^docker/"
# ----------------------------------- Python formatters & linters stack
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
hooks:
- id: black
language_version: python3.11 # <-- was python3.13
- repo: https://github.com/PyCQA/isort
rev: 8.0.1
hooks:
- id: isort
args: ["--profile", "black"]
language_version: python3.11 # <-- was python3.13
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6 # keep in sync with your lockfile/ruff version
hooks:
# If you want the formatter, uncomment:
# - id: ruff-format
# stages: [commit]
# Linter + auto-fix on commit
- id: ruff
name: ruff-lint-fix
args:
["--fix", "--exit-non-zero-on-fix", "--show-fixes", "--unsafe-fixes"]
stages: [pre-commit] # <-- was [commit]
# Strict linter on push/CI (no fixes)
- id: ruff
name: ruff-lint-ci
args: ["--show-source"]
stages: [pre-push] # <-- was [push]
- repo: local
hooks:
- id: pytest
name: Run pytest
entry: poetry run pytest -q
language: system
types: [python]
files: "\\.py$"
pass_filenames: false
always_run: true