Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
58 lines (54 loc) 路 2.16 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
58 lines (54 loc) 路 2.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
# Local mirror of the CI lint and format gate, so failures surface before push
# rather than in the pipeline. Install with `make install-dev`.
#
# The global exclude covers files no hook should touch at all. A top-level
# directory whose name starts with `_` holds material that is not part of the
# distribution, and uv owns uv.lock's format. Notebooks are NOT global: they
# are exempt per-hook from the rewriting checks (a whitespace fix on notebook
# JSON is a large unreviewable diff) while staying subject to the size check.
# Global and per-hook excludes are cumulative, so a globally excluded path
# cannot be re-included by a single hook.
exclude: '^_[^/]+/|^uv\.lock$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '\.ipynb$'
- id: end-of-file-fixer
exclude: '\.ipynb$'
- id: mixed-line-ending
exclude: '\.ipynb$'
- id: check-merge-conflict
- id: check-yaml
- id: check-json
- id: check-toml
- id: debug-statements
- id: check-added-large-files
# Notebooks stay in scope, so one committed with its outputs fails
# here. uv.lock is exempt via the global exclude: it is a committed
# resolved graph that grows with the dependency set.
args: ["--maxkb=600"]
# Ruff runs through `uv run` rather than pre-commit's own mirror so the
# version always matches the pin in pyproject.toml. A mirrored rev drifts
# from the project pin and then pre-commit and CI disagree about what
# "clean" means. `types: [python]` means notebooks are not passed here --
# identify tags .ipynb as `jupyter`, not `python`.
- repo: local
hooks:
- id: ruff
name: ruff (lint)
entry: uv run ruff check --fix
language: system
types: [python]
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types: [python]
# Notebooks are committed as source only: outputs carry run data and local
# paths from whoever executed them.
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout