From 0dfdf52c3f1233a83322d8bc06b9b3a3afdddcad Mon Sep 17 00:00:00 2001 From: Leonardo Santiago Date: Wed, 1 Oct 2025 12:50:21 -0300 Subject: [PATCH 1/4] chore: drop pre-commit, add makefile target to install local commit hooks this should ensure that pre-commit does not install the same tools (ruff) with different versions and cause weird mismatch errors with the ones from uv. --- .pre-commit-config.yaml | 28 ---------------------------- Makefile | 27 ++++++++++++++++++++++----- 2 files changed, 22 insertions(+), 33 deletions(-) delete mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index f53369a4..00000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,28 +0,0 @@ -exclude: '^.*\.(md|MD)$' -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 - hooks: - - id: trailing-whitespace - - id: check-added-large-files - - id: end-of-file-fixer - - id: mixed-line-ending - args: ["--fix=lf"] - - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.12.1 - hooks: - # Run the linter. - - id: ruff - types_or: [ python, pyi ] - args: [ --fix ] - # Run the formatter. - - id: ruff-format - types_or: [ python, pyi ] - - - repo: https://github.com/commitizen-tools/commitizen - rev: v3.22.0 - hooks: - - id: commitizen - stages: [commit-msg] diff --git a/Makefile b/Makefile index 370dbb98..9d585d39 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,6 @@ ci: pre-commit $(call FORALL_PKGS,tests) help:: @echo " ci -- Run tests for all packages, the same way as CI does" -pre-commit: - uv run pre-commit run --all-files -help:: - @echo " pre-commit -- Run pre-commit on all files" - clean: $(call FORALL_PKGS,clean) rm -rf dist .ruff_cache .pytest_cache help:: @@ -35,6 +30,28 @@ help:: @echo " stop-infra -- Stop all infra used by tests." @echo " NOTE: run this command to ensure all containers are stopped after tests" +define RUFF_HOOK_CONTENTS +#!/bin/sh +echo 'Running ruff checks on all files' +uv run ruff check --fix +uv run ruff format +endef +export RUFF_HOOK_CONTENTS +define COMMITIZEN_HOOK_CONTENTS +#!/bin/sh +echo 'Running commitizen on message' +MSG_FILE=$$1 +uv tool run --from commitizen cz check --allow-abort --commit-msg-file $$MSG_FILE +endef +export COMMITIZEN_HOOK_CONTENTS +pre-commit: + @echo "$$RUFF_HOOK_CONTENTS" > .git/hooks/pre-commit + @chmod +x .git/hooks/pre-commit + @echo "$$COMMITIZEN_HOOK_CONTENTS" > .git/hooks/commit-msg + @chmod +x .git/hooks/commit-msg +help:: + @echo " pre-commit -- Install custom pre-commit hooks locally." + @echo " -- NOTE: Do this at least once after cloning the repo." realtime.%: @$(MAKE) -C src/realtime $* From 208676e7619ac332c6b4224df16060374f2c6b84 Mon Sep 17 00:00:00 2001 From: Leonardo Santiago Date: Wed, 1 Oct 2025 13:02:40 -0300 Subject: [PATCH 2/4] fix: create `ruff` target in main makefile bruh --- Makefile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 9d585d39..410d48be 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ help:: @echo "Available commands" @echo " help -- (default) print this message" -ci: pre-commit $(call FORALL_PKGS,tests) +ci: ruff $(call FORALL_PKGS,tests) help:: @echo " ci -- Run tests for all packages, the same way as CI does" @@ -30,27 +30,26 @@ help:: @echo " stop-infra -- Stop all infra used by tests." @echo " NOTE: run this command to ensure all containers are stopped after tests" -define RUFF_HOOK_CONTENTS -#!/bin/sh -echo 'Running ruff checks on all files' -uv run ruff check --fix -uv run ruff format -endef -export RUFF_HOOK_CONTENTS + +ruff: + uv run ruff check --fix + uv run ruff format +help:: + @echo " ruff -- Run ruff checks on all files." + define COMMITIZEN_HOOK_CONTENTS #!/bin/sh -echo 'Running commitizen on message' MSG_FILE=$$1 uv tool run --from commitizen cz check --allow-abort --commit-msg-file $$MSG_FILE endef export COMMITIZEN_HOOK_CONTENTS -pre-commit: - @echo "$$RUFF_HOOK_CONTENTS" > .git/hooks/pre-commit +install-hooks: + @echo "make ruff" > .git/hooks/pre-commit @chmod +x .git/hooks/pre-commit @echo "$$COMMITIZEN_HOOK_CONTENTS" > .git/hooks/commit-msg @chmod +x .git/hooks/commit-msg help:: - @echo " pre-commit -- Install custom pre-commit hooks locally." + @echo " install-hooks -- Install custom pre-commit hooks locally." @echo " -- NOTE: Do this at least once after cloning the repo." realtime.%: From e2a4b5b8c95d045b690021879706a17973d9386d Mon Sep 17 00:00:00 2001 From: Leonardo Santiago Date: Wed, 1 Oct 2025 13:09:00 -0300 Subject: [PATCH 3/4] fix: make ruff calls silent --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 410d48be..0ad307af 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,8 @@ help:: ruff: - uv run ruff check --fix - uv run ruff format + @uv run ruff check --fix + @uv run ruff format help:: @echo " ruff -- Run ruff checks on all files." From 8d4e1c0cbe4e7e0cd7a41f5813fc81fd553ec95a Mon Sep 17 00:00:00 2001 From: Leonardo Santiago Date: Wed, 1 Oct 2025 14:33:25 -0300 Subject: [PATCH 4/4] chore: add install-hooks to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2d7713a..2920be8b 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ To run each of the packages' tests in parallel. This should be generally faster Other relevant commands include ```bash -make pre-commit # run lints and formmating before commiting +make install-hooks # install all commit hooks into the local .git folder make stop-infra # stops all running containers from all packages make clean # delete all intermediary files created by testing ```