-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path.pre-commit-config.yaml
144 lines (134 loc) · 3.41 KB
/
.pre-commit-config.yaml
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
138
139
140
141
142
143
144
# If need global exclude:
# exclude: "^docs/conf.py"
# NOTE:
# Where excluding "docs/user_guide", that is because these are auto-generated files.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
args: [
"--markdown-linebreak-ext=md",
]
exclude: "docs/user_guide"
- id: check-added-large-files
args: [
"--maxkb=1000",
]
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
- id: check-executables-have-shebangs
- id: debug-statements
- id: end-of-file-fixer
exclude: "docs/user_guide"
- id: pretty-format-json
args: [
"--autofix",
"--indent=4",
"--no-sort-keys",
]
exclude: ".*.ipynb" # Do not want .ipynb to be treated as JSON.
- id: requirements-txt-fixer
exclude: docs/requirements.txt
- id: mixed-line-ending
args: [
"--fix=auto",
]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black-jupyter
language_version: python3
exclude: "docs/user_guide"
# If like to embrace black styles even in the docs:
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [
"black",
]
exclude: "docs/user_guide"
# Standard `flake8` run for all Python files:
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
hooks:
- id: mypy
files: "^src/"
args: [
"--config-file=mypy.ini",
]
# NOTE:
# Re. additional **typed dependencies** and pre-commit mypy: https://stackoverflow.com/a/74291151.
# The list of typed dependencies below needs to be kept up-to-date with `setup.cfg` for mypy errors to match
# the development environment. The typical "mismatched" mypy error that happens if these are not kept in sync is:
# `error: Unused "type: ignore" comment [unused-ignore]`.
additional_dependencies: [
"dask[dataframe]",
"hydra-core >=1.3",
"hyperimpute >= 0.1.17",
"loguru",
"optuna >= 2.8.0",
"pandas >= 1",
"pandera >= 0.17.0",
"pydantic >= 2",
"torch",
"tsai",
]
# NOTE:
# src/tempor/models/clairvoyance2/ is excluded via file `# mypy: ignore-errors` comments as otherwise mypy
# does not appear to ignore this properly.
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
args: [
"-c",
"pyproject.toml",
"-q"
]
additional_dependencies: [
"bandit[toml]",
]
exclude: "^src/tempor/models/clairvoyance2/.*"
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: [
"tomli", # To read configuration from pyproject.toml.
]
exclude: |
(?x)^(
docs/.*|
tests/.*|
src/tempor/models/clairvoyance2/.*
)$
# `pydoclint` run via `flake8`, with some additional locations ignored.
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
name: "pydoclint_via_flake8"
additional_dependencies: [
"pydoclint",
]
exclude: |
(?x)^(
docs/.*|
tests/.*|
src/tempor/models/clairvoyance2/.*
)$