From 6edb5a9e796bdff09f8f5b1c8dbfa415d9859356 Mon Sep 17 00:00:00 2001 From: Suhas <139655090+suhaslord@users.noreply.github.com> Date: Sun, 23 Aug 2026 10:27:46 -0700 Subject: [PATCH 1/2] chore: add pre-commit hooks --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c246019 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: + - repo: local + hooks: + - id: flake8-critical + name: flake8 critical errors + entry: poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + language: system + pass_filenames: false + + - id: mypy + name: mypy + entry: poetry run mypy cmr tests + language: system + pass_filenames: false + + - id: pytest + name: pytest + entry: poetry run pytest + language: system + pass_filenames: false + stages: [pre-push] From 85b70b81724d7a8402a702303a362fdb7d54deca Mon Sep 17 00:00:00 2001 From: Suhas <139655090+suhaslord@users.noreply.github.com> Date: Sun, 23 Aug 2026 10:27:53 -0700 Subject: [PATCH 2/2] docs: document local pre-commit workflow --- CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e31c7a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing + +## Development setup + +Install the project dependencies with Poetry: + +```bash +poetry install +``` + +## Pre-commit checks + +The repository includes pre-commit hooks that mirror the important local CI checks: + +- critical `flake8` errors run before commits; +- `mypy` runs before commits; +- the full `pytest` suite runs before pushes. + +Install pre-commit, then enable both hook stages: + +```bash +python -m pip install pre-commit +pre-commit install --hook-type pre-commit --hook-type pre-push +``` + +Run all commit-stage hooks manually with: + +```bash +pre-commit run --all-files +``` + +Run the pre-push test hook manually with: + +```bash +pre-commit run --all-files --hook-stage pre-push +``` + +The hook commands use the project's Poetry environment, so run `poetry install` first.