Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
77 lines (70 loc) · 2.59 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
77 lines (70 loc) · 2.59 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
---
# 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: f22ea0651f4355c655cc581f67813c991c74a312 # frozen: v3.22.0
hooks:
- id: pyupgrade
args: [--py39-plus]
# Automatically sort python imports
- repo: https://github.com/pycqa/isort
rev: 5d9c96196def28a1819b6a755a669ec0a3add6aa # frozen: 10.0.0b2
hooks:
- id: isort
args: [--profile, black]
# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 258e7dbf348bc23cb70b8cdf693481c04634ebcc # frozen: 26.10.1
hooks:
- id: black
args: [--target-version=py39]
# Check python code static typing
- repo: https://github.com/pre-commit/mirrors-mypy
rev: ad26ebfa797fcb9b8f83275937c1c1d6e126719c # frozen: v2.4.1
hooks:
- id: mypy
args: [--config, ./mypy.ini]
additional_dependencies: ["pytest"]
# 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/rbubley/mirrors-prettier
rev: 331f33fa4dfbcbca7c3da3620c137fde0faab273 # frozen: v3.9.10
hooks:
- id: prettier
# `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: trailing-whitespace
# Lint: Python
- repo: https://github.com/PyCQA/flake8
rev: 960c1d286190804104f7255b97da034446fdaac3 # frozen: 7.5.0
hooks:
- id: flake8
# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: cbcdc463be5464e25e3e955a511599a67b9b987f # frozen: v0.50.0
hooks:
- id: markdownlint
args: ["--fix"]