From 2755dc373a8c8b1e8774cf709417ab777eb83699 Mon Sep 17 00:00:00 2001 From: Sven Geboers Date: Tue, 24 Mar 2026 22:41:40 +0100 Subject: [PATCH] chore(format): add pre-commit and formatter configs --- .pre-commit-config.yaml | 22 ++++++++++++++++------ tests/config/test_formatters_present.py | 14 ++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tests/config/test_formatters_present.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7ecbbe..1d7a6e1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/tests/config/test_formatters_present.py b/tests/config/test_formatters_present.py new file mode 100644 index 0000000..58cd8b3 --- /dev/null +++ b/tests/config/test_formatters_present.py @@ -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" + )