-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
110 lines (100 loc) · 3.67 KB
/
.pre-commit-config.yaml
File metadata and controls
110 lines (100 loc) · 3.67 KB
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
---
# 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: 75992aaa40730136014f34227e0135f63fc951b4 # frozen: v3.21.2
hooks:
- id: pyupgrade
args: [--py312-plus]
# Automatically sort python imports
- repo: https://github.com/PyCQA/isort
rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1
hooks:
- id: isort
args: [--profile, black]
# Autoformat: Python code
- repo: https://github.com/psf/black-pre-commit-mirror
rev: ea488cebbfd88a5f50b8bd95d5c829d0bb76feb8 # frozen: 26.1.0
hooks:
- id: black
args: [--target-version=py312]
# Check python code static typing
- repo: https://github.com/pre-commit/mirrors-mypy
rev: a66e98df7b4aeeb3724184b332785976d062b92e # frozen: v1.19.1
hooks:
- id: mypy
args: [--config, ./mypy.ini]
additional_dependencies:
[
"numpy",
"pytest",
"requests",
"urllib3",
"types-requests",
"types-tabulate",
"types-urllib3",
]
# Unfortunately, `pre-commit` only runs on modified 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/rbubley/mirrors-prettier
rev: c2bc67fe8f8f549cc489e00ba8b45aa18ee713b1 # frozen: v3.8.1
hooks:
- id: prettier
exclude: "{{cookiecutter.stack_name}}/.github/workflows/docker.yml"
# `pre-commit sample-config` default hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.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: 4e697ba704fd23b2409b947a319c19c3ee54d24f # frozen: v2.14.0
hooks:
- id: hadolint-docker
entry: hadolint/hadolint:v2.14.0 hadolint
# Lint: YAML
- repo: https://github.com/adrienverge/yamllint
rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0
hooks:
- id: yamllint
args: ["-d {extends: relaxed, rules: {line-length: disable}}", "-s"]
exclude: "{{cookiecutter.stack_name}}/.github/workflows/docker.yml"
# Lint: Python
- repo: https://github.com/PyCQA/flake8
rev: d93590f5be797aabb60e3b09f2f52dddb02f349f # frozen: 7.3.0
hooks:
- id: flake8
# Lint: Markdown
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: 5387279b3b4c24822c0f86d4df4f28b37e3e8992 # frozen: v0.21.0
hooks:
- id: markdownlint-cli2
args: [--fix]
# 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]