Skip to content

Commit 4e5f7e2

Browse files
committed
Update pre-commit and execute it
1 parent d70bfc3 commit 4e5f7e2

35 files changed

+1507
-266
lines changed

.bandit.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.flake8

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
version: 2
23
updates:
34
- package-ecosystem: github-actions

.github/release-drafter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
categories:
23
- title: ":boom: Breaking Changes"
34
label: "breaking"

.github/workflows/constraints.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
---
12
name: Manage labels
23

4+
# yamllint disable-line rule:truthy
35
on:
46
push:
57
branches:

.github/workflows/release-drafter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
---
12
name: Draft a release note
3+
4+
# yamllint disable-line rule:truthy
25
on:
36
push:
47
branches:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ dmypy.json
138138
.npm
139139

140140
# Dependency directories
141-
node_modules/
141+
node_modules/

.pre-commit-config.yaml

Lines changed: 125 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,133 @@
11
---
22
repos:
3-
- repo: https://github.com/PyCQA/bandit
4-
rev: 1.6.2
5-
hooks:
6-
- id: bandit
7-
args:
8-
- --quiet
9-
- --format=custom
10-
- --configfile=.bandit.yaml
11-
files: ^pyhilo/.+\.py$
12-
- repo: https://github.com/python/black
13-
rev: 22.12.0
14-
hooks:
15-
- id: black
16-
args:
17-
- --safe
18-
- --quiet
19-
language_version: python3
20-
files: ^((pyhilo|tests)/.+)?[^/]+\.py$
21-
- repo: https://github.com/codespell-project/codespell
22-
rev: v1.16.0
3+
- repo: local
234
hooks:
5+
- id: ruff-check
6+
name: 🐶 Ruff Linter
7+
language: system
8+
types: [python]
9+
entry: poetry run ruff check --fix
10+
require_serial: true
11+
stages: [pre-commit, pre-push, manual]
12+
- id: ruff-format
13+
name: 🐶 Ruff Formatter
14+
language: system
15+
types: [python]
16+
entry: poetry run ruff format
17+
require_serial: true
18+
stages: [pre-commit, pre-push, manual]
19+
- id: check-ast
20+
name: 🐍 Check Python AST
21+
language: system
22+
types: [python]
23+
entry: poetry run check-ast
24+
- id: check-case-conflict
25+
name: 🔠 Check for case conflicts
26+
language: system
27+
entry: poetry run check-case-conflict
28+
- id: check-docstring-first
29+
name: ℹ️ Check docstring is first
30+
language: system
31+
types: [python]
32+
entry: poetry run check-docstring-first
33+
- id: check-executables-have-shebangs
34+
name: 🧐 Check that executables have shebangs
35+
language: system
36+
types: [text, executable]
37+
entry: poetry run check-executables-have-shebangs
38+
stages: [pre-commit, pre-push, manual]
39+
- id: check-json
40+
name: { Check JSON files
41+
language: system
42+
types: [json]
43+
entry: poetry run check-json
44+
- id: check-merge-conflict
45+
name: 💥 Check for merge conflicts
46+
language: system
47+
types: [text]
48+
entry: poetry run check-merge-conflict
49+
- id: check-symlinks
50+
name: 🔗 Check for broken symlinks
51+
language: system
52+
types: [symlink]
53+
entry: poetry run check-symlinks
54+
- id: check-toml
55+
name: ✅ Check TOML files
56+
language: system
57+
types: [toml]
58+
entry: poetry run check-toml
59+
- id: check-xml
60+
name: ✅ Check XML files
61+
entry: check-xml
62+
language: system
63+
types: [xml]
64+
- id: check-yaml
65+
name: ✅ Check YAML files
66+
language: system
67+
types: [yaml]
68+
entry: poetry run check-yaml
2469
- id: codespell
25-
args:
26-
- --skip="./.*,*.json"
27-
- --quiet-level=4
28-
- -L ba,celcius,hass
29-
exclude_types: [json]
30-
- repo: https://github.com/PyCQA/flake8
31-
rev: 4.0.1
32-
hooks:
33-
- id: flake8
34-
additional_dependencies:
35-
- flake8-docstrings==1.5.0
36-
- pydocstyle==5.0.1
37-
files: ^pyhilo/.+\.py$
38-
- repo: https://github.com/pre-commit/mirrors-isort
39-
rev: v4.3.21
40-
hooks:
41-
- id: isort
42-
additional_dependencies:
43-
- toml
44-
files: ^(pyhilo|tests)/.+\.py$
45-
- repo: https://github.com/pre-commit/mirrors-mypy
46-
rev: v0.920
47-
hooks:
70+
name: ✅ Check code for common misspellings
71+
language: system
72+
types: [text]
73+
exclude: ^poetry\.lock$
74+
entry: poetry run codespell
75+
- id: detect-private-key
76+
name: 🕵️ Detect Private Keys
77+
language: system
78+
types: [text]
79+
entry: poetry run detect-private-key
80+
- id: end-of-file-fixer
81+
name: ⮐ Fix End of Files
82+
language: system
83+
types: [text]
84+
entry: poetry run end-of-file-fixer
85+
stages: [pre-commit, pre-push, manual]
4886
- id: mypy
49-
files: ^pyhilo/.+\.py$
50-
additional_dependencies:
51-
- types-python-dateutil==2.8.0
52-
- types-aiofiles==23.2.0
53-
54-
- repo: https://github.com/pre-commit/pre-commit-hooks
55-
rev: v5.0.0
56-
hooks:
57-
- id: check-json
87+
name: 🆎 Static type checking using mypy
88+
language: system
89+
types: [python]
90+
entry: poetry run mypy
91+
require_serial: true
5892
- id: no-commit-to-branch
93+
name: 🛑 Don't commit to main branch
94+
language: system
95+
entry: poetry run no-commit-to-branch
96+
pass_filenames: false
97+
always_run: true
5998
args:
60-
- --branch=dev
6199
- --branch=main
62-
# - repo: https://github.com/PyCQA/pydocstyle
63-
# rev: 5.0.2
64-
# hooks:
65-
# - id: pydocstyle
66-
# files: ^((pyhilo|tests)/.+)?[^/]+\.py$
67-
- repo: https://github.com/gruntwork-io/pre-commit
68-
rev: v0.1.12
69-
hooks:
70-
- id: shellcheck
71-
files: ^script/.+
100+
- id: poetry
101+
name: 📜 Check pyproject with Poetry
102+
language: system
103+
entry: poetry check
104+
pass_filenames: false
105+
always_run: true
106+
- id: prettier
107+
name: 💄 Ensuring files are prettier
108+
language: system
109+
types: [yaml, json, markdown]
110+
entry: npm run prettier
111+
pass_filenames: false
112+
- id: pylint
113+
name: 🌟 Starring code with pylint
114+
language: system
115+
types: [python]
116+
entry: poetry run pylint
117+
- id: pytest
118+
name: 🧪 Running tests and test coverage with pytest
119+
language: system
120+
types: [python]
121+
entry: poetry run pytest
122+
pass_filenames: false
123+
- id: trailing-whitespace
124+
name: ✄ Trim Trailing Whitespace
125+
language: system
126+
types: [text]
127+
entry: poetry run trailing-whitespace-fixer
128+
stages: [pre-commit, pre-push, manual]
129+
- id: yamllint
130+
name: 🎗 Check YAML files with yamllint
131+
language: system
132+
types: [yaml]
133+
entry: poetry run yamllint

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ check [the contributor's page][contributors].
7474

7575

7676

77-
[build-shield]: https://github.com/dvd-dev/python-hilo/actions/workflows/tests.yaml/badge.svg
78-
[build]: https://github.com/dvd-dev/python-hilo/actions/workflows/tests.yaml
77+
[build-shield]: https://github.com/dvd-dev/python-hilo/actions/workflows/linting.yaml/badge.svg
78+
[build]: https://github.com/dvd-dev/python-hilo/actions/workflows/linting.yaml
7979
[releases-shield]: https://img.shields.io/github/release/dvd-dev/python-hilo.svg
8080
[releases]: https://github.com/dvd-dev/python-hilo/releases
8181
[license-shield]: https://img.shields.io/github/license/dvd-dev/python-hilo.svg
@@ -86,4 +86,4 @@ check [the contributor's page][contributors].
8686
[pre-commit]: https://pre-commit.com/
8787
[dvd-dev]: https://github.com/dvd-dev
8888
[frenck]: https://github.com/frenck
89-
[contributors]: https://github.com/dvd-dev/python-hilo/graphs/contributors
89+
[contributors]: https://github.com/dvd-dev/python-hilo/graphs/contributors

0 commit comments

Comments
 (0)