-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
151 lines (136 loc) · 4.27 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
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.10
minimum_pre_commit_version: 3.1.1
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
args: [
'--maxkb=350',
# this is ok, but since in papers we have some large files, we just considered
# the staged one
# '--enforce-all',
]
- id: check-ast
- id: check-builtin-literals
- 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/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
# matches also eval in PyTorch
# - 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
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
args:
- --whitespaces-count
- "4" # defaults to: 4
- id: insert-license
files: \.py$
args:
- --license-filepath
# defaults to: LICENSE.txt
- COPYRIGHT
- --comment-style
# defaults to: #
- "#"
- --use-current-year
- repo: local
hooks:
# - id: nox-test
# name: test session with nox
# entry: nox --noxfile .noxfile.py --envdir .nox.pre-commit --session test --verbose --add-timestamp
# pass_filenames: false
# stages: [manual]
# language: python
# additional_dependencies: ['nox==2022.11.21']
# - id: nox-linting
# name: linting session with nox
# entry: nox --noxfile .noxfile.py --envdir .nox.pre-commit --session linting --verbose --add-timestamp --
# types_or: [python, pyi, jupyter]
# pass_filenames: true
# stages: [manual]
# language: python
# additional_dependencies: ['nox==2022.11.21']
- id: mkinit-init-generation
name: generate init automatically with mkinit
entry: mkinit --recursive --black --lazy src/enpheeph
types_or: [python]
pass_filenames: false
# if not set it covers all stages
# stages: [pre-commit, manual]
language: python
additional_dependencies: ['mkinit==1.0.0']
# ruff before other linting
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.245'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.0.1" # Use the sha / tag you want to point at
hooks:
- id: mypy
# args: [--ignore-missing-imports, src/enpheeph]
# args: [--ignore-missing-imports, --config-file=pyproject.toml, src/enpheeph]
pass_filenames: true
# continuous integration configuration for pre-commit.ci
# freely available to open-source repositories
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
submodules: false