-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
136 lines (119 loc) · 3.52 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
ci:
skip: [pylint-local]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: check-toml
- 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
# Verify the contents of pyproject.toml
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.13
hooks:
- id: validate-pyproject
# Updating code to use modern python patterns where available.
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
# General Project code formatter.
- repo: https://github.com/psf/black
rev: 23.3.0
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.12.0
hooks:
- id: isort
args: ['--profile=black']
# Formats python docstrings.
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.1
hooks:
- id: docformatter
# Formats code-blocks in documentation.
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
# Note - on black update blacken-docs pin should also be updated.
additional_dependencies: ['black==22.12.0']
# Used to detect unintentionally unused code.
- repo: https://github.com/asottile/dead
rev: v1.5.1
hooks:
- id: dead
args: [
'--exclude=conf.py' # Ignore the sphinx config as this is used by an external tool.
]
# Lint documentation source.
- repo: https://github.com/sphinx-contrib/sphinx-lint
# Make sure to also update the additional dependency pin
rev: v0.6.7
hooks:
- id: sphinx-lint
# lint documentation
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
# 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.3.0
hooks:
- id: mypy
# A faster python linter
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.269'
hooks:
- id: ruff
# Lint code using libs in project venv.
- repo: local
hooks:
# Pylint is run as local hook to make use of the repo venv.
- id: pylint-local
name: pylint-local
entry: pylint
language: system
types: [ python ]
args: [
'--ignore=conf.py', # Ignore the sphinx config as this is used by an external tool.
]
require_serial: true
# Lint code in pre-commit env, note: This ignores import checks.
- repo: https://github.com/PyCQA/pylint
rev: v2.17.4
hooks:
# Pylint is also run from within pre-commit for CI purposes.
- id: pylint
args: [
'--disable=E0401', # Ignore imports when not running in a local env.
'--ignore=conf.py', # Ignore the sphinx config as this is used by an external tool.
]
# Lint code for security flaws.
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
# Assert is used exclusively in pytest.
args: ['--skip=B101']