-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
174 lines (174 loc) · 4.91 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
174
---
exclude: |
(?x)
^README\.md$|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
repos:
- repo: https://github.com/jazzband/pip-tools
rev: 6.14.0
hooks:
- id: pip-compile
name: pip-compile requirements.txt
files: ^(pyproject\.toml)$
- id: pip-compile
name: pip-compile requirements-dev.txt
args:
- "--extra=dev"
- "--output-file=requirements-dev.txt"
files: ^pyproject\.(toml)$
- id: pip-compile
name: pip-compile requirements-test.txt
args:
- "--extra=test"
- "--output-file=requirements-test.txt"
files: ^pyproject\.(toml)$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
additional_dependencies:
- "prettier"
- "prettier-plugin-toml"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.md$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.md$
- id: debug-statements
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-added-large-files
args: ["--maxkb=500"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-json
- id: check-xml
- id: check-yaml
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
- id: requirements-txt-fixer
args:
["requirements.txt", "requirements-dev.txt", "requirements-test.txt"]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.1
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.991
# hooks:
# - id: mypy
# exclude: |
# (?x)(
# /__init__\.py$|
# ^migrations/
# )
- repo: https://github.com/mondeja/pre-commit-po-hooks
rev: v1.7.3
hooks:
- id: obsolete-messages
- id: untranslated-messages
- id: fuzzy-messages
# - id: remove-metadata
- id: standard-metadata
# - id: max-lines
# args: ["10000"]
- id: min-translated
args:
- "90%"
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.3.0
hooks:
- id: add-trailing-comma
args: ["--py36-plus"]
- repo: https://github.com/myint/autoflake
rev: v1.6.1
hooks:
- id: autoflake
args:
[
"-i",
"--ignore-init-module-imports",
"--remove-all-unused-imports",
"--remove-duplicate-keys",
]
- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
additional_dependencies: ["click<8.1.0"]
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
- repo: https://github.com/PyCQA/pylint
rev: v2.15.3
hooks:
- id: pylint
name: pylint with optional checks
additional_dependencies:
[
"aerich==0.7.2",
"aiohttp==3.8.6",
"asyncpraw==7.7.1",
"asyncprawcore==2.3.0",
"cashews==5.3.2",
"diskcache==5.6.3",
"pydantic-settings==2.0.3",
"pylint-pydantic==0.2.4",
"pykeyboard==0.1.5",
"pyrogram==2.0.106",
"python-dotenv==0.21.1",
"tgcrypto==1.2.5",
]
args:
[
"--rcfile=.pylintrc",
"--load-plugins=pylint_pydantic",
"--exit-zero",
]
exclude: ^migrations/
verbose: true
- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
name: flake8 except __init__.py
exclude: |
(?x)(
/__init__\.py$|
^migrations/
)
args: ["--extend-ignore=E203"] # ignore whitespace before ':'
additional_dependencies: ["flake8-bugbear"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear"]
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
name: isort except __init__.py
args: ["--settings", "pyproject.toml"]
exclude: /__init__\.py$