-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
57 lines (55 loc) · 2.52 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
57 lines (55 loc) · 2.52 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
default_install_hook_types:
- pre-commit
- pre-push
repos:
- repo: local
hooks:
# ---- pre-commit: auto-format + lint on staged commits ----
- id: make-format-pythinker-code
name: make format-pythinker-code (pre-commit)
entry: make format-pythinker-code
language: system
stages: [pre-commit]
pass_filenames: false
- id: make-check-pythinker-code
name: make check-pythinker-code (pre-commit)
entry: make check-pythinker-code
language: system
stages: [pre-commit]
pass_filenames: false
# ---- pre-push: mirror CI gate so nothing leaves the dev box that the
# CI `check` job would reject. Format first (auto-fixes; prek/pre-commit
# aborts the push if any files were modified — dev must re-stage and
# re-commit before pushing again), then ruff check --fix --exit-non-zero
# for any residual lint, then the same `make check-pythinker-code`
# target the CI workflow runs (ruff check + ruff format --check +
# pyright). Passing this hook means `check` will pass on the PR.
- id: pre-push-ruff-format
name: "pre-push: ruff format (auto-fix, blocks push if modified)"
entry: make format-pythinker-code
language: system
stages: [pre-push]
pass_filenames: false
- id: pre-push-ruff-check-fix
name: "pre-push: ruff check --fix (auto-fix lints)"
entry: bash -c "uv run ruff check --fix --exit-non-zero-on-fix"
language: system
stages: [pre-push]
pass_filenames: false
- id: pre-push-ci-check
name: "pre-push: make check-pythinker-code (CI-equivalent gate)"
entry: make check-pythinker-code
language: system
stages: [pre-push]
pass_filenames: false
# CI runs the test suite separately from `check` and that failure mode
# has bitten us (a kwarg added to an internal helper broke a test that
# asserted exact kwargs, but `check` was green). Run the same tests
# locally before push. Set PYTHINKER_SKIP_PRE_PUSH_TESTS=1 to skip when
# the change is doc-only or a hot follow-up to an unrelated CI failure.
- id: pre-push-tests
name: "pre-push: make test-pythinker-code (CI-equivalent tests)"
entry: bash -c '[ "${PYTHINKER_SKIP_PRE_PUSH_TESTS:-0}" = "1" ] && { echo "pre-push tests skipped via PYTHINKER_SKIP_PRE_PUSH_TESTS=1"; exit 0; }; make test-pythinker-code'
language: system
stages: [pre-push]
pass_filenames: false