Skip to content

Commit c03d608

Browse files
committed
add precommit checks
1 parent 55b8d43 commit c03d608

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ __pycache__
22
icon
33
venv
44
hass-custom-pyscript.zip
5+
.coverage

.pre-commit-config.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 19.10b0
4+
hooks:
5+
- id: black
6+
args:
7+
- --safe
8+
- --quiet
9+
files: ^((custom_components|tests)/.+)?[^/]+\.py$
10+
- repo: https://github.com/codespell-project/codespell
11+
rev: v1.16.0
12+
hooks:
13+
- id: codespell
14+
args:
15+
- --ignore-words-list=hass
16+
- --skip="./.*,*.csv,*.json"
17+
- --quiet-level=2
18+
exclude_types: [csv, json]
19+
- repo: https://gitlab.com/pycqa/flake8
20+
rev: 3.8.3
21+
hooks:
22+
- id: flake8
23+
additional_dependencies:
24+
- flake8-docstrings==1.5.0
25+
- pydocstyle==5.0.2
26+
files: ^(custom_components|tests)/.+\.py$
27+
- repo: https://github.com/PyCQA/bandit
28+
rev: 1.6.2
29+
hooks:
30+
- id: bandit
31+
args:
32+
- --quiet
33+
- --format=custom
34+
- --configfile=tests/bandit.yaml
35+
files: ^(custom_components|tests)/.+\.py$
36+
- repo: https://github.com/pre-commit/mirrors-isort
37+
rev: v4.3.21
38+
hooks:
39+
- id: isort
40+
- repo: https://github.com/pre-commit/pre-commit-hooks
41+
rev: v2.4.0
42+
hooks:
43+
- id: check-executables-have-shebangs
44+
stages: [manual]
45+
- id: check-json
46+
- repo: https://github.com/adrienverge/yamllint.git
47+
rev: v1.23.0
48+
hooks:
49+
- id: yamllint

.yamllint

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
ignore: |
2+
azure-*.yml
3+
rules:
4+
braces:
5+
level: error
6+
min-spaces-inside: 0
7+
max-spaces-inside: 1
8+
min-spaces-inside-empty: -1
9+
max-spaces-inside-empty: -1
10+
brackets:
11+
level: error
12+
min-spaces-inside: 0
13+
max-spaces-inside: 0
14+
min-spaces-inside-empty: -1
15+
max-spaces-inside-empty: -1
16+
colons:
17+
level: error
18+
max-spaces-before: 0
19+
max-spaces-after: 1
20+
commas:
21+
level: error
22+
max-spaces-before: 0
23+
min-spaces-after: 1
24+
max-spaces-after: 1
25+
comments:
26+
level: error
27+
require-starting-space: true
28+
min-spaces-from-content: 2
29+
comments-indentation:
30+
level: error
31+
document-end:
32+
level: error
33+
present: false
34+
document-start:
35+
level: error
36+
present: false
37+
empty-lines:
38+
level: error
39+
max: 1
40+
max-start: 0
41+
max-end: 1
42+
hyphens:
43+
level: error
44+
max-spaces-after: 1
45+
indentation:
46+
level: error
47+
spaces: 2
48+
indent-sequences: true
49+
check-multi-line-strings: false
50+
key-duplicates:
51+
level: error
52+
line-length: disable
53+
new-line-at-end-of-file:
54+
level: error
55+
new-lines:
56+
level: error
57+
type: unix
58+
trailing-spaces:
59+
level: error
60+
truthy:
61+
level: error

tests/bandit.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://bandit.readthedocs.io/en/latest/config.html
2+
3+
tests:
4+
- B108
5+
- B306
6+
- B307
7+
- B313
8+
- B314
9+
- B315
10+
- B316
11+
- B317
12+
- B318
13+
- B319
14+
- B320
15+
- B325
16+
- B602
17+
- B604

0 commit comments

Comments
 (0)