-
Notifications
You must be signed in to change notification settings - Fork 5
/
.pre-commit-config.yaml
164 lines (147 loc) · 5.16 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
---
minimum_pre_commit_version: 2.10.1
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
description: Check for files that contain merge conflict strings.
language_version: python3
- id: trailing-whitespace
description: Trims trailing whitespace.
args: [--markdown-linebreak-ext=md]
language_version: python3
- id: mixed-line-ending
description: Replaces or checks mixed line ending.
args: [--fix=lf]
exclude: make.bat
language_version: python3
- id: fix-byte-order-marker
description: Removes UTF-8 BOM if present, generally a Windows problem.
language_version: python3
- id: end-of-file-fixer
description: Makes sure files end in a newline and only a newline.
exclude: tests/fake_.*\.key
language_version: python3
- id: check-ast
description: Simply check whether files parse as valid python.
language_version: python3
- id: check-yaml
- id: check-json
# ----- Formatting ---------------------------------------------------------------------------->
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
name: Remove unused variables and imports
language: python
args: ["--in-place", "--remove-all-unused-imports", "--remove-unused-variables", "--expand-star-imports"]
files: \.py$
- repo: https://github.com/saltstack/pre-commit-remove-import-headers
rev: 1.1.0
hooks:
- id: remove-import-headers
- repo: https://github.com/asottile/pyupgrade
rev: v2.38.4
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.7+
args: [--py37-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:
- id: reorder-python-imports
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: []
- repo: https://github.com/asottile/blacken-docs
rev: v1.10.0
hooks:
- id: blacken-docs
additional_dependencies: [black==21.7b0]
- repo: https://github.com/myint/rstcheck
rev: 3f92957
hooks:
- id: rstcheck
name: Check reST files using rstcheck
args: [--report=warning]
additional_dependencies: [sphinx]
# <---- Formatting -----------------------------------------------------------------------------
# ----- Testing Static Requirements ------------------------------------------------------------------------------------>
- repo: https://github.com/saltstack/pip-tools-compile-impersonate
rev: '4.1'
hooks:
- id: pip-tools-compile
alias: compile-3.7-test-requirements
name: Py3.7 Test Requirements
files: ^requirements/tests.in$
pass_filenames: false
args:
- -v
- --py-version=3.7
- --platform=linux
- --no-emit-index-url
- requirements/tests.in
- id: pip-tools-compile
alias: compile-3.8-test-requirements
name: Py3.8 Test Requirements
files: ^requirements/tests.in$
pass_filenames: false
args:
- -v
- --py-version=3.8
- --platform=linux
- --no-emit-index-url
- requirements/tests.in
- id: pip-tools-compile
alias: compile-3.9-test-requirements
name: Py3.9 Test Requirements
files: ^requirements/tests.in$
pass_filenames: false
args:
- -v
- --py-version=3.9
- --platform=linux
- --no-emit-index-url
- requirements/tests.in
- id: pip-tools-compile
alias: compile-3.10-test-requirements
name: Py3.10 Test Requirements
files: ^requirements/tests.in$
pass_filenames: false
args:
- -v
- --py-version=3.10
- --platform=linux
- --no-emit-index-url
- requirements/tests.in
# <---- Testing Static Requirements -------------------------------------------------------------------------------------
# ----- Docs -------------------------------------------------------------------------------------------------->
- repo: https://github.com/saltstack/mirrors-nox
rev: v2020.8.22
hooks:
- id: nox
alias: Generate Sphinx docs
description: Generate Sphinx docs, ensure they build
files: ^((CONTRIBUTING|README)|docs/.*)\.rst$
args:
- -e
- 'docs-html(clean=True)'
- --
# <---- Docs ---------------------------------------------------------------------------------------------------
# ----- Security -------------------------------------------------------------------------------------------------->
- repo: https://github.com/PyCQA/bandit
rev: "1.7.0"
hooks:
- id: bandit
name: Run bandit against POP project
args: [--silent, -lll]
files: .*\.py
exclude: >
(?x)^(
tests/.*
)$
# <---- Security ---------------------------------------------------------------------------------------------------