-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
173 lines (156 loc) · 5.36 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.9
default_stages: [commit, merge-commit, manual]
minimum_pre_commit_version: 2.15.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
args: [
'--maxkb=350',
'--enforce-all',
]
# exclude: |
# (?x)^(
# papers/ijcnn2022/comparisons/tensorfi2/results/alexnet-cifar10/weights/alexnet-cifar10.pt|
# papers/ijcnn2022/experiments/image_classifier_resnet18_null_cifar10_false_false.pt|
# papers/ijcnn2022/experiments/image_classifier_resnet18_null_cifar10_true_false__non_deterministic.pt|
# papers/ijcnn2022/experiments/semantic_segmenter_mobilenetv3_large_100_fpn_carla_false_false.pt|
# papers/ijcnn2022/experiments/semantic_segmenter_mobilenetv3_large_100_fpn_carla_true_false.pt
# )$
# exclude: |
# (?x)^(
# docs/source/_static/images/general/fast_2.gif|
# docs/source/_static/images/mnist_imgs/pt_to_pl.jpg|
# docs/source/_static/images/lightning_module/pt_to_pl.png|
# docs/source/_static/images/general/pl_quick_start_full_compressed.gif|
# docs/source/_static/images/general/pl_overview_flat.jpg|
# docs/source/_static/images/general/pl_overview.gif
# )$
- id: check-ast
- id: check-builtin-literals
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-json
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: check-xml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
# to add -*- coding: utf-8 -*- to the top of python files
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: pretty-format-json
args: [
"--autofix",
"--indent",
"4",
]
- id: name-tests-test
args: ['--django'] # we match for test*.py
# to sort entries in requirements.txt
- id: requirements-txt-fixer
- id: sort-simple-yaml
- id: trailing-whitespace
- repo: https://github.com/psf/black
# with stable it always uses the latest version
# otherwise use a specific tag
# pre-commit gives warnings for mutable references, as they are not updated
# unless you uses pre-commit autoupdate
rev: 21.9b0
hooks:
- id: black
args: [
"--line-length=88",
"--target-version=py38",
]
- repo: https://github.com/commitizen-tools/commitizen
rev: v1.17.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [
"--max-line-length=88",
"--extend-ignore=E203",
"--max-complexity=10",
]
# mypy and pre-commit hooks are not nice together if the project
# has dependencies which are difficult to install
# for now we simply run it locally and later also in a CI
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1 # Use the sha / tag you want to point at
hooks:
# there are issues in using the project-wide configuration, so
# things should be repeated here if needed, e.g. skipping tests
- id: mypy
# the additional dependencies are installed if required in the
# execution
additional_dependencies: [
# cupy>=9.4.0,
# numpy,
# pytorch-lightning>=1.4.5,
# sqlalchemy>=1.4.22,
# torch>=1.9,
"packaging==21.0",
"sqlalchemy[mypy]==1.4.22",
"types-setuptools==57.4.2",
"types-pkg-resources==0.1.3",
]
args: [
# mypy is used from a venv, so it will not have all the
# dependencies available
--ignore-missing-imports,
]
files: ^src/enpheeph,
# we remove the manual stage for mypy, as there are problems in the CI
# with sqlalchemy
# they have been fixed but it has not been released yet
stages: [commit, merge-commit]
# for running linters on jupyter notebooks
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.1.1
# hooks:
# - id: nbqa-black
# - id: nbqa-pyupgrade
# args: [--py36-plus]
# - id: nbqa-isort
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-no-eval
- id: python-no-log-warn
# not needed as we use Python 3.8+
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
# continuous integration configuration for pre-commit.ci
# freely available to open-source repositories
# it will not be run until we are open-source
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit hooks
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: [mypy]
submodules: false