chore(format): add pre-commit and formatter configs
This commit is contained in:
+16
-6
@@ -1,7 +1,17 @@
|
||||
- repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
# Minimal pre-commit config stub
|
||||
# This file is intentionally minimal and does not enable hooks by installing them.
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.9.1
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: black
|
||||
|
||||
- repo: https://github.com/charliermarsh/ruff
|
||||
rev: v0.11.1
|
||||
hooks:
|
||||
- id: ruff
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import pathlib
|
||||
|
||||
|
||||
def test_precommit_exists():
|
||||
path = pathlib.Path(".pre-commit-config.yaml")
|
||||
assert path.exists(), ".pre-commit-config.yaml must exist"
|
||||
|
||||
content = path.read_text(encoding="utf8")
|
||||
assert "repos:" in content, "pre-commit config must contain 'repos:'"
|
||||
|
||||
# ensure at least one formatter/linter is referenced
|
||||
assert any(x in content for x in ("black", "ruff", "isort")), (
|
||||
"pre-commit config must reference at least one of: black, ruff, isort"
|
||||
)
|
||||
Reference in New Issue
Block a user