-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit-config.yaml.template
More file actions
54 lines (51 loc) · 1.95 KB
/
Copy pathpre-commit-config.yaml.template
File metadata and controls
54 lines (51 loc) · 1.95 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
# Pre-commit hooks for scientific Python repos (copy to .pre-commit-config.yaml).
# Install once per clone: pip install pre-commit && pre-commit install
# Docstring style is Google everywhere: pydoclint --style google, darglint2 -s google.
# ruff runs NO docstring checks by default - enable them in pyproject.toml:
# [tool.ruff.lint]
# extend-select = ["D"] # D1xx flag MISSING docstrings
# [tool.ruff.lint.pydocstyle]
# convention = "google"
# (pydoclint/darglint2 only validate docstrings that exist; without the D rules
# an undocumented module passes the stack green. Exempt tests/ or legacy dirs
# via [tool.ruff.lint.per-file-ignores].)
repos:
# Format Python code consistently (black-jupyter also formats .ipynb cells;
# the plain 'black' id skips notebooks).
- repo: https://github.com/psf/black
rev: 25.9.0
hooks:
- id: black-jupyter
# Strip notebook outputs before commit: keeps diffs reviewable and keeps
# data, rendered plots, and tokens out of git history.
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
# Lint and auto-fix (docstring checks only with the D rules enabled, above).
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.1
hooks:
- id: ruff
args: [--fix]
# Docstring signature/section validation.
- repo: local
hooks:
- id: pydoclint
name: pydoclint
entry: pydoclint
args: [--style, google]
language: python
types: [python]
additional_dependencies: ["pydoclint"]
# Add legacy files that predate the hooks to this regex instead of fixing
# them wholesale; new files must pass.
# exclude: "^legacy_module\\.py$"
- id: darglint2
name: darglint2
entry: darglint2
language: python
types: [python]
args: [-s, google, -z, full]
additional_dependencies: ["darglint2"]
# exclude: "^legacy_module\\.py$"