-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
103 lines (91 loc) · 3.12 KB
/
.pre-commit-config.yaml
File metadata and controls
103 lines (91 loc) · 3.12 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
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
# These are safe to run in both local & CI (they don't require "fix vs check" split)
- id: check-added-large-files
stages: [pre-commit, manual]
- id: check-yaml
stages: [pre-commit, manual]
- id: check-toml
stages: [pre-commit, manual]
- id: check-merge-conflict
stages: [pre-commit, manual]
- id: name-tests-test
args: [--pytest-test-first]
stages: [pre-commit, manual]
# These modify files. Run locally only (pre-commit stage).
- id: end-of-file-fixer
stages: [pre-commit]
- id: trailing-whitespace
stages: [pre-commit]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.19.0
hooks:
- id: pyproject-fmt
stages: [pre-commit] # modifies -> local only
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
stages: [pre-commit, manual]
# NOTE: @C-Achard 2026-03-18 disabled for now
# It had its use in introducing and enforcing linting, especially for docstrings
# but now ruff should be our de-facto linter.
# Only re-enable if we end up requiring large-scale docstring reformatting
# or we need some features from this in the future
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.7
# hooks:
# - id: docformatter
# name: docformatter (fix)
# args: [--wrap-descriptions=88, --wrap-summaries=88, --in-place, --black]
# stages: [pre-commit]
# - id: docformatter
# name: docformatter (ci)
# args: [--wrap-descriptions=88, --wrap-summaries=88, --check, --black]
# stages: [manual]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6
hooks:
# --------------------------
# LOCAL AUTOFIX (developers)
# --------------------------
- id: ruff-check
name: ruff-check (fix)
args: [--fix, --unsafe-fixes]
stages: [pre-commit]
- id: ruff-format
name: ruff-format (write)
stages: [pre-commit]
# --------------------------
# CI CHECK-ONLY (no writes)
# --------------------------
- id: ruff-check
name: ruff-check (ci)
args: [--output-format=github]
stages: [manual]
- id: ruff-format
name: ruff-format (ci)
args: [--check, --diff]
stages: [manual]
# check only, no modifications
- repo: local
hooks:
- id: dlc-docs-notebooks-check
name: DLC docs+notebooks staleness/check + nbformat validate + normalization
entry: python tools/docs_and_notebooks_check.py
language: python
pass_filenames: true
files: ^(docs/|examples/(JUPYTER|COLAB)/|tools/).*(\.md|\.ipynb)$
args:
- --config
- tools/docs_and_notebooks_report_config.yml
- check
- --targets
additional_dependencies:
- "pydantic>=2,<3"
- "pyyaml"
- "nbformat>=5"
stages: [pre-commit, manual]