-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
111 lines (98 loc) · 2.92 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
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-docstring-first
- id: mixed-line-ending
- id: check-case-conflict
- id: check-ast
- id: requirements-txt-fixer
- id: debug-statements
- id: check-builtin-literals
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
# Check for common yaml errors
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
hooks:
- id: yamllint
args: [--no-warnings, -d, "{extends: relaxed, rules: {new-lines: disable}}"]
# Format markdown docs.
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 0.7.17
hooks:
- id: mdformat
args: [--number, --end-of-line=keep]
additional_dependencies:
- mdformat-toc
- mdformat-config
- mdformat-gfm
# General project code formatter.
- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black
# Sorts python imports.
- repo: https://github.com/PyCQA/isort
# Note - on black update blacken-docs pin should also be updated.
rev: 5.13.2
hooks:
- id: isort
args: ['--profile=black']
# Formats python docstrings.
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
# Used to detect unintentionally unused code.
- repo: https://github.com/asottile/dead
rev: v1.5.2
hooks:
- id: dead
args: [
'--exclude=conf.py' # Ignore the sphinx config as this is used by an external tool.
]
# Lint code in pre-commit env, note: This ignores import checks.
- repo: https://github.com/PyCQA/pylint
rev: v3.0.3
hooks:
- id: pylint
args: [
'--disable=E0401', # Ignore imports when not running in a local env.
'--disable=R0903', # Class are built on interfaces so too few methods isn't important.
]
# Lint code for security flaws.
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
hooks:
- id: bandit
args: [
--skip, "B101"
# B101 Assert is used exclusively for tests.
]
# Lint docstrings.
- repo: https://github.com/PyCQA/pydocstyle
# Waiting for a 3.10 release on pypi
rev: "6.3.0"
hooks:
- id: pydocstyle
additional_dependencies:
# TOML support only added natively in python 3.11
- toml
# Static typehint linting.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
# Catch typos!
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell