-
Notifications
You must be signed in to change notification settings - Fork 34
/
.pre-commit-config.yaml
172 lines (171 loc) · 4.96 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
166
167
168
169
170
171
172
---
files: ^(.*\.(py|json|md|sh|yaml|cfg|txt))$
exclude: ^(\.[^/]*cache/.*|.*/_user.py)$
repos:
- repo: https://github.com/verhovsky/pyupgrade-docs
rev: v0.3.0
hooks:
- id: pyupgrade-docs
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 0.7.17
hooks:
- id: mdformat
name: Format Markdown
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
additional_dependencies:
- mdformat-toc
- mdformat-beautysh
# -mdformat-shfmt
# -mdformat-tables
- mdformat-config
- mdformat-black
- mdformat-web
- mdformat-gfm
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.6.0]
stages: [manual] # Manual because already done by mdformat-black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: end-of-file-fixer
- id: trailing-whitespace
- id: no-commit-to-branch
args: [--branch, main]
- id: check-yaml
args: [--unsafe]
- id: debug-statements
- id: check-json
- id: check-builtin-literals
- id: check-ast
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-docstring-first
- id: check-case-conflict
# - id: check-toml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:
- id: yamllint
args:
- --no-warnings
- -d
- '{extends: relaxed, rules: {line-length: {max: 90}}}'
- repo: https://github.com/lovesegfault/beautysh.git
rev: v6.2.1
hooks:
- id: beautysh
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
files: ^[^\.].*\.sh$
# add "shellcheck disable=SC2086" codes to files, rather than global excludes:
# args: [-x,-e2086,-e2004,-e2207,-e2002,-e2116]
# args: ["--severity=warning"] # Optionally only show errors and warnings
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
# Note, added for future reference, not used
- id: ruff
stages: [manual]
- id: ruff-format
stages: [manual]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args:
- --py39-plus
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
args:
- --safe
- --quiet
- -l 79
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
rev: v1.0.6
hooks:
- id: python-bandit-vulnerability-check
args: [--skip, 'B101,B311', --recursive, .]
- repo: https://github.com/fsouza/autoflake8
rev: v0.4.1
hooks:
- id: autoflake8
args:
- -i
- -r
- --expand-star-imports
- custom_components
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
# - pyproject-flake8>=0.0.1a5
- flake8-bugbear>=22.7.1
- flake8-comprehensions>=3.10.1
- flake8-2020>=1.7.0
- mccabe>=0.7.0
- pycodestyle>=2.9.1
- pyflakes>=2.5.0
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args:
# - --builtin=clear,rare,informal,usage,code,names,en-GB_to_en-US
- --builtin=clear,rare,informal,usage,code,names
- --ignore-words-list=hass,master
- --skip="./.*"
- --quiet-level=2
- repo: https://github.com/pylint-dev/pylint
rev: v3.0.3
hooks:
- id: pylint
args:
- --reports=no
- --py-version=3.10
additional_dependencies:
- aiofiles>=0.4.0
# - pylint-blocking-calls
# - homeassistant-stubs>=2023.1.7
# exclude: ^$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
hooks:
- id: mypy
args:
# - --verbose
# - --config-file=setup.cfg
- --ignore-missing-imports
- --install-types
- --non-interactive
- --check-untyped-defs
- --show-error-codes
- --show-error-context
additional_dependencies:
- zigpy==0.61.0
- aiofiles>=0.4.0
# - cryptography==3.3.2 # Compatible/Available on cygwin
#- homeassistant-stubs>=2023.1.7
#- pydantic