Pre-review
Run local checks on the current branch before opening a pull request.
Steps
Gather branch context
BRANCH=$(git branch --show-current) BASE="main" git log --oneline "$BASE"..HEAD git diff --stat "$BASE"..HEADGroup changed files by area
- List files changed vs main
- Categorize: source (
arksim/), tests (tests/), docs (docs/), config, other
Draft and validate title
- Infer type and scope from changes
- Propose a title matching:
^(feat|fix|docs|chore|ci|build|refactor|test|perf|style|revert)(\([a-z][a-z0-9_-]*\))?!?: .+$ - Verify max 72 characters
- Recommend a scope if omitted
Run ruff check
ruff check . 2>&1Run ruff format check
ruff format --check . 2>&1Run unit tests
pytest tests/unit/ -x --tb=short 2>&1Check code quality in diff
- For new
.pyfiles in the diff, verify:# SPDX-License-Identifier: Apache-2.0header presentfrom __future__ import annotationspresent- Type annotations on function signatures
- Absolute imports only (no relative imports)
- For new
Check changelog
- If source files changed, check for an entry in CHANGELOG.md under
[Unreleased]
- If source files changed, check for an entry in CHANGELOG.md under
Output
Print a readiness checklist:
Pre-review checklist
--------------------
[ ] Branch: <branch-name>
[x] Ruff check: PASS / FAIL (N issues)
[x] Ruff format: PASS / FAIL (N files)
[x] Unit tests: PASS / FAIL (N passed, N failed)
[x] License headers: PASS / FAIL / N/A
[x] Future annotations: PASS / FAIL / N/A
[x] Type hints: PASS / WARN / N/A
[x] Absolute imports: PASS / FAIL / N/A
[x] Changelog updated: YES / NO / N/A
[x] Suggested title: <title>
Ready to open PR: YES / NO