-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46d4d8b
commit 1416d01
Showing
3 changed files
with
63 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
# auto-update pre-commit versions (if > 1 week) | ||
if which runonce &> /dev/null; then | ||
if [ which runonce &> /dev/null ]; then | ||
DIR=`basename $(pwd)` | ||
|
||
# install any missing requirements | ||
if [ -d .venv ]; then | ||
if [ -f requirements.txt ]; then | ||
runonce -b -n $DIR uv pip install -r requirements.txt | ||
fi | ||
|
||
if [ -f requirements-dev.txt ]; then | ||
runonce -b -n $DIR uv pip install -r requirements-dev.txt | ||
fi | ||
fi | ||
|
||
# auto-update pre-commit versions (if > 1 week) | ||
runonce -b -n $DIR -d 7 pre-commit autoupdate | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
|
||
# isort - sort import statements | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: black | ||
args: [--config=pyproject.toml] | ||
- repo: https://github.com/hadialqattan/pycln | ||
rev: v2.4.0 | ||
- id: isort | ||
files: \.(py)$ | ||
args: [--settings-path=pyproject.toml] # ["--profile", "black" ] | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.4 | ||
hooks: | ||
- id: pycln | ||
args: [--config=pyproject.toml] | ||
#- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# rev: 'v0.0.262' | ||
# hooks: | ||
# - id: ruff | ||
- id: ruff | ||
args: [ --fix ] # run linter | ||
- id: ruff-format # run formatter | ||
|
||
|
||
#### OPTIONAL: for keeping syntax more current | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.2 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py311-plus] # NOTE: SET TO HOME ASSISTANT VERSION | ||
|
||
- repo: https://github.com/dosisod/refurb | ||
rev: v2.0.0 | ||
hooks: | ||
- id: refurb # NOTE: Update pyproject.toml to match HA Python version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[tool.isort] | ||
force_to_top = [ "logging" ] | ||
balanced_wrapping = true | ||
|
||
[tool.ruff] | ||
line-length = 88 | ||
indent-width = 4 | ||
|
||
[tool.ruff.format] | ||
quote-style = "single" # Use a single quote instead of double | ||
|
||
[tool.pycln] | ||
all = true | ||
|
||
[tool.refurb] | ||
python_version = "3.11" | ||
quiet = true | ||
ignore = [ "FURB184" ] |