-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
165 lines (149 loc) · 4.71 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
---
# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Run on all files: pre-commit run --all-files
# - Register git hooks: pre-commit install --install-hooks
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# Autoupdate: Python code
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py39-plus]
# Automatically sort python imports
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]
# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
args: [--target-version=py39]
# Check python code static typing
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
args: [--config, ./mypy.ini]
additional_dependencies:
[
"beautifulsoup4",
"numpy",
"pytest",
"requests",
"urllib3",
"types-beautifulsoup4",
"types-requests",
"types-tabulate",
"types-urllib3",
]
# Unfortunately, `pre-commit` only runs on changed files
# This doesn't work well with `mypy --follow-imports error`
# See: https://github.com/pre-commit/mirrors-mypy/issues/34#issuecomment-1062160321
#
# To work around this we run `mypy` only in manual mode
# So it won't run as part of `git commit` command
# But it will still be run as part of `pre-commit` workflow and give expected results
stages: [manual]
# Autoformat: YAML, JSON, Markdown, etc.
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
# `pre-commit sample-config` default hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
# Lint: Dockerfile
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
hooks:
- id: hadolint-docker
entry: hadolint/hadolint:v2.12.1-beta hadolint
# Lint: Dockerfile
# We're linting .dockerfile files as well
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
hooks:
- id: hadolint-docker
name: Lint *.dockerfile Dockerfiles
entry: hadolint/hadolint:v2.12.1-beta hadolint
types: [file]
files: \.dockerfile$
# Lint: YAML
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: ["-d {extends: relaxed, rules: {line-length: disable}}", "-s"]
files: \.(yaml|yml)$
# Lint: Bash scripts
- repo: https://github.com/openstack/bashate
rev: 2.1.1
hooks:
- id: bashate
args: ["--ignore=E006"]
# Lint: Shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
args: ["-x"]
# Lint: Python
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
hooks:
- id: markdownlint
args: ["--fix"]
# Strip output from Jupyter notebooks
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
# nbQA provides tools from the Python ecosystem like
# pyupgrade, isort, black, and flake8, adjusted for notebooks.
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.8.5
hooks:
- id: nbqa-pyupgrade
args: [--py39-plus]
- id: nbqa-isort
- id: nbqa-black
args: [--target-version=py39]
- id: nbqa-flake8
# Run black on python code blocks in documentation files.
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
# --skip-errors is added to allow us to have python syntax highlighting even if
# the python code blocks include jupyter-specific additions such as % or !
# See https://github.com/adamchainz/blacken-docs/issues/127 for an upstream
# feature request about this.
args: [--target-version=py39, --skip-errors]
# pre-commit.ci config reference: https://pre-commit.ci/#configuration
ci:
autoupdate_schedule: monthly
# Docker hooks do not work in pre-commit.ci
# See: <https://github.com/pre-commit-ci/issues/issues/11>
skip: [hadolint-docker]