Skip to content

Commit

Permalink
build: clean up pre-commit and tooling
Browse files Browse the repository at this point in the history
Replace a few tools with ruff in the process.

Signed-off-by: Felix Kaechele <felix@kaechele.ca>
  • Loading branch information
kaechele committed Dec 28, 2023
1 parent 47be2fd commit 15f2298
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 133 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

47 changes: 13 additions & 34 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,29 @@ repos:
hooks:
- id: prettier
args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff-format
name: ruff (format)
args: ["."]
pass_filenames: false
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
name: ruff (lint)
args:
- "--fix"
- "--exit-non-zero-on-fix"
- "--statistics"
- "--output-format=text"
- "."
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
Expand All @@ -86,20 +84,6 @@ repos:
rev: v0.7.3
hooks:
- id: pydocstringformatter
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- pycodestyle==2.10.0
- pyflakes==3.0.1
- flake8-docstrings==1.7.0
- pydocstyle==6.3.0
- flake8-comprehensions==3.10.1
- flake8-noqa==1.3.0
- mccabe==0.7.0
exclude: (docs|tests|setup.py)
stages: [manual]
- repo: https://github.com/cdce8p/python-typing-update
rev: v0.6.0
hooks:
Expand All @@ -113,11 +97,6 @@ repos:
- --py310-plus
- --force
- --keep-updates
- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: bandit
args: [-x, tests]
- repo: https://github.com/lunarmodules/luacheck
rev: v1.1.2
hooks:
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
<a href="https://python-poetry.org/">
<img src="https://img.shields.io/badge/packaging-poetry-299bd7?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAASCAYAAABrXO8xAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJJSURBVHgBfZLPa1NBEMe/s7tNXoxW1KJQKaUHkXhQvHgW6UHQQ09CBS/6V3hKc/AP8CqCrUcpmop3Cx48eDB4yEECjVQrlZb80CRN8t6OM/teagVxYZi38+Yz853dJbzoMV3MM8cJUcLMSUKIE8AzQ2PieZzFxEJOHMOgMQQ+dUgSAckNXhapU/NMhDSWLs1B24A8sO1xrN4NECkcAC9ASkiIJc6k5TRiUDPhnyMMdhKc+Zx19l6SgyeW76BEONY9exVQMzKExGKwwPsCzza7KGSSWRWEQhyEaDXp6ZHEr416ygbiKYOd7TEWvvcQIeusHYMJGhTwF9y7sGnSwaWyFAiyoxzqW0PM/RjghPxF2pWReAowTEXnDh0xgcLs8l2YQmOrj3N7ByiqEoH0cARs4u78WgAVkoEDIDoOi3AkcLOHU60RIg5wC4ZuTC7FaHKQm8Hq1fQuSOBvX/sodmNJSB5geaF5CPIkUeecdMxieoRO5jz9bheL6/tXjrwCyX/UYBUcjCaWHljx1xiX6z9xEjkYAzbGVnB8pvLmyXm9ep+W8CmsSHQQY77Zx1zboxAV0w7ybMhQmfqdmmw3nEp1I0Z+FGO6M8LZdoyZnuzzBdjISicKRnpxzI9fPb+0oYXsNdyi+d3h9bm9MWYHFtPeIZfLwzmFDKy1ai3p+PDls1Llz4yyFpferxjnyjJDSEy9CaCx5m2cJPerq6Xm34eTrZt3PqxYO1XOwDYZrFlH1fWnpU38Y9HRze3lj0vOujZcXKuuXm3jP+s3KbZVra7y2EAAAAAASUVORK5CYII=" alt="Poetry">
</a>
<a href="https://github.com/ambv/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="black">
</a>
<a href="https://github.com/pre-commit/pre-commit">
<img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=flat-square" alt="pre-commit">
</a>
Expand Down
82 changes: 1 addition & 81 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 24 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ aenum = "^3.1.11"
[tool.poetry.group.dev.dependencies]
pytest = "^7.0"
pytest-cov = "^4.0.0"
black = "^23.1.0"
pylint = "^3.0.0"

[tool.poetry.group.docs]
Expand All @@ -56,9 +55,6 @@ build_command = "pip install poetry && poetry build"
addopts = "-v -Wdefault --cov=bonaparte --cov-report=term-missing:skip-covered"
pythonpath = ["src"]

[tool.black]
target-version = ["py311", "py312"]

[tool.coverage.run]
branch = true

Expand All @@ -71,14 +67,6 @@ exclude_lines = [
'if __name__ == "__main__":',
]

[tool.isort]
profile = "black"
known_first_party = ["bonaparte", "tests"]
force_sort_within_sections = true
forced_separate = [
"tests",
]

[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
Expand Down Expand Up @@ -151,9 +139,33 @@ unfixable = ["ERA"]
# Same as Black.
line-length = 88

[tool.ruff.flake8-import-conventions.extend-aliases]
voluptuous = "vol"
"homeassistant.helpers.area_registry" = "ar"
"homeassistant.helpers.config_validation" = "cv"
"homeassistant.helpers.device_registry" = "dr"
"homeassistant.helpers.entity_registry" = "er"
"homeassistant.helpers.issue_registry" = "ir"
"homeassistant.util.dt" = "dt_util"

[tool.ruff.flake8-pytest-style]
fixture-parentheses = false

[tool.ruff.flake8-tidy-imports.banned-api]
"async_timeout".msg = "use asyncio.timeout instead"
"pytz".msg = "use zoneinfo instead"

[tool.ruff.isort]
force-sort-within-sections = true
combine-as-imports = true
split-on-trailing-comma = false

[tool.ruff.per-file-ignores]
"tests/*" = ["S101"]

[tool.ruff.mccabe]
max-complexity = 25

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 15f2298

Please sign in to comment.