From 4dabfcce38ff6b0d5caf72bdde6aa047e69fb9ed Mon Sep 17 00:00:00 2001 From: jink-ucla Date: Thu, 26 Feb 2026 22:24:51 -0800 Subject: [PATCH] Harden pre-commit safety hooks and document local checks --- .pre-commit-config.yaml | 10 ++++++++++ CONTRIBUTING.md | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e5671abd8..a584559ed8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,14 @@ repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: detect-private-key + - id: check-added-large-files + args: ["--maxkb=1000"] + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/pycqa/isort rev: "7.0.0" hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2492b74a24..aeb9baa63a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,6 +40,18 @@ When developing features that interact with LLMs: 2. **Integration Testing**: Use your actual API key and configure `api_base` if using alternative providers 3. **Cost Management**: Consider using cheaper models or [optillm](https://github.com/codelion/optillm) for rate limiting during development +### Pre-commit Checks + +Before opening a PR, install and run the configured pre-commit hooks: + +```bash +pip install pre-commit +pre-commit install +pre-commit run --all-files +``` + +These hooks catch common issues early, including malformed YAML, accidental private key commits, trailing whitespace, and overly large files. + ## Pull Request Process 1. Create a new branch for your feature or bugfix: `git checkout -b feat-your-feature-name`