-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
137 lines (121 loc) · 4.35 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
137 lines (121 loc) · 4.35 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types:
- pre-commit
- commit-msg
default_language_version:
python: python3
ci:
skip:
- generate-pixi-docs
- settings-doc-check
- check-all-required
- check-all-forbidden
default_stages: [pre-commit]
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: ["--verbose"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: ["--unsafe"]
- id: check-added-large-files
exclude: pixi\.lock$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.16.2"
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.3.0
hooks:
- id: mypy
additional_dependencies:
- pydantic
- sqlalchemy
- types-PyYAML
- types-cachetools
- types-requests
- types-python-dateutil
- types-croniter
exclude: ^(diracx-client/src/diracx/client/_generated|diracx-[a-z]+/tests/|diracx-testing/|build|extensions/gubbins/gubbins-client/src/gubbins/client/_generated)
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
args: ["--number"]
exclude: ^CHANGELOG\.md$
additional_dependencies:
- mdformat-mkdocs
- mdformat-gfm
- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell
# Configuration lives in [tool.codespell] in pyproject.toml
additional_dependencies:
- tomli
exclude: pixi\.lock$
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.12.0
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.29.0
hooks:
- id: zizmor
- repo: local
hooks:
- id: check-lollygag
name: check for lollygag
types: [python]
entry: "(?i)lollygag"
language: pygrep
files: ^diracx
- repo: local
hooks:
- id: generate-pixi-docs
name: Generate pixi tasks documentation
entry: pixi run -e default python scripts/generate_pixi_tasks_doc.py
language: system
pass_filenames: false
files: ^pixi\.toml$|^pixi\.lock$ # only run if pixi files change
- repo: local
hooks:
- id: settings-doc-check
name: Generate settings documentation
entry: pixi run -e default python scripts/generate_settings_docs.py
language: system
pass_filenames: false
files: ^(diracx-.*/src/diracx/.*/settings\.py|diracx-routers/src/diracx/routers/otel\.py|docs/.*\.j2|docs/templates/.*\.jinja|scripts/generate_settings_docs\.py)$
- repo: local
hooks:
# Files that must declare ``__all__`` as a list:
# - any ``__init__.py`` under ``src/<root>/<subpkg>/``
# - top-level modules at ``src/<root>/<subpkg>/<file>.py`` (siblings of subpackages)
- id: check-all-required
name: Require __all__ list in package and top-level subpackage modules
language: system
entry: pixi run -e default python scripts/check_init_files_precommit_hook.py --mode=require-list
files: ^(diracx-|extensions/gubbins/gubbins-)[a-z]+/src/[a-z]+/[a-z]+/((.*/)*__init__\.py|[a-zA-Z0-9_]+\.py)$
exclude: (test|_generated|__main__)
# Files that must NOT declare ``__all__`` — submodules of a subpackage
# expose their names via the subpackage ``__init__.py`` instead. The
# ``patches`` exclusion covers the diracx-client merge layer, which
# follows a different convention dictated by the autogenerated client.
- id: check-all-forbidden
name: Forbid __all__ in subpackage submodules
language: system
entry: pixi run -e default python scripts/check_init_files_precommit_hook.py --mode=forbid
files: ^(diracx-|extensions/gubbins/gubbins-)[a-z]+/src/[a-z]+/[a-z]+/[a-z_]+/.+\.py$
exclude: (__init__\.py$|test|_generated|__main__|/patches/)