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..0ad307af 100644 --- a/Makefile +++ b/Makefile @@ -7,15 +7,10 @@ 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" -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:: @@ -36,6 +31,27 @@ help:: @echo " NOTE: run this command to ensure all containers are stopped after tests" +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 +MSG_FILE=$$1 +uv tool run --from commitizen cz check --allow-abort --commit-msg-file $$MSG_FILE +endef +export COMMITIZEN_HOOK_CONTENTS +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 " install-hooks -- Install custom pre-commit hooks locally." + @echo " -- NOTE: Do this at least once after cloning the repo." + realtime.%: @$(MAKE) -C src/realtime $* 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 ```