-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
169 lines (169 loc) · 5.08 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
# Update all versions in this file by running:
# $ pre-commit autoupdate
minimum_pre_commit_version: 3.3.2
default_language_version:
python: python3.11
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
name: Check for a blank line at the end of scripts (auto-fixes)
- id: trailing-whitespace
- id: check-builtin-literals
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: debug-statements
- id: detect-private-key
- id: mixed-line-ending
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-yaml
- id: check-added-large-files
name: Check for files larger than 5 MB
args: ["--maxkb=5120"]
- id: check-ast
- id: check-docstring-first
- id: name-tests-test
args: ["--django"]
- repo: https://github.com/myint/autoflake
rev: v2.1.1
hooks:
- id: autoflake
args: &autoflake
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- &flake8
id: flake8
additional_dependencies:
- flake8-bugbear==23.3.12
- flake8-comprehensions==3.12.0
- flake8-docstrings==1.7.0
- flake8-eradicate==1.4.0
- flake8-fixme==1.1.1
- flake8-implicit-str-concat==0.4.0
- flake8-mutable==1.2.0
- flake8-no-pep420==2.4.0
- flake8-print==5.0.0
- flake8-return==1.2.0
- flake8-simplify==0.19.3
args: ["--config=setup.cfg"]
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
types: [python]
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args:
- "--py311-plus"
- repo: https://github.com/pycqa/bandit
rev: 1.7.5
hooks:
- id: bandit
args: ["-ii", "-ll"]
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
- id: detect-secrets
name: detect-secrets - Detect secrets in staged code
args: [
"--baseline",
".secrets.baseline",
# https://regex101.com/
"--exclude-files 'poetry\\.lock'",
"--exclude-files '\\.secrets\\.baseline'",
"--exclude-files '\\.env\\.template'",
# "--exclude-files '.*\\.ipynb$'",
# "--exclude-files '.*build/'",
"--exclude-secrets 'password|ENTER_PASSWORD_HERE|INSERT_API_KEY_HERE'",
"--exclude-lines 'integrity=*sha'",
]
# https://pre-commit.com/#regular-expressions
exclude: |
(?x)^(
poetry\.lock|
\.secrets\.baseline|
\.env\.template
)$
# - repo: https://github.com/python-poetry/poetry
# rev: 1.4.0
# hooks:
# - id: poetry-check
# - id: poetry-lock
# args: ["--no-update"]
# - id: poetry-export
# args:
# [
# "-f",
# "requirements.txt",
# "-o",
# "requirements.txt",
# "--without-hashes",
# ]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier
types_or: [yaml]
additional_dependencies:
- "prettier@2.8.4"
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint europython_prague tests
# entry: bash -c 'pylint ./path/package1/; pylint ./path/package2/'
language: system
types: [python]
always_run: true
pass_filenames: false
stages: [manual]
- id: pip-audit
name: pip-audit
entry: pip-audit
# Exclusions example
# entry: pip-audit --ignore-vuln PYSEC-2022-42974 --ignore-vuln GHSA-w596-4wvx-j9j6
language: system
always_run: true
pass_filenames: false
stages: [manual]
# TODO: Remove once this is resolved
# https://github.com/python-poetry/poetry/issues/2765
# https://github.com/python-poetry/poetry/issues/7075
- id: poetry-lock
name: poetry-lock
# entry: bash -c 'poetry lock && python add_markers.py'
entry: bash -c 'poetry lock --no-update'
language: system
always_run: true
pass_filenames: false
- id: poetry-export
name: poetry-export
entry: poetry export -f requirements.txt --output requirements.txt --without-hashes
language: system
always_run: true
pass_filenames: false