From 5fadef3bfb49485e8f46eec2a057109fb62ab6fe Mon Sep 17 00:00:00 2001 From: Justin Braaten Date: Thu, 4 Jun 2026 13:12:33 -0700 Subject: [PATCH] Align GitHub lint checks with Google3 CheckLint for Xee PiperOrigin-RevId: 926848396 --- .github/workflows/lint.yml | 3 +-- .pre-commit-config.yaml | 14 ++++++++++++++ docs/contributing.md | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1d76061..cfe26e9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -60,5 +60,4 @@ jobs: pip install -e .[tests] - name: Lint with pyink run: | - echo "Lint check temporarily disabled" - # pyink --check . + pyink --check . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..051401c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + + - repo: https://github.com/google/pyink + rev: v24.4.0 + hooks: + - id: pyink + types_or: [python, pyi] diff --git a/docs/contributing.md b/docs/contributing.md index fbd359d..b7b8479 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -59,6 +59,30 @@ pixi run -e docs docs-check `docs-build` builds the HTML docs, while `docs-check` runs a stricter Sphinx build with warnings treated as errors. +### Code style & formatting + +We use `pyink` to format Python code, enforcing a 2-space indentation style to +match Google standards. To automate this and ensure your changes pass CI lint +checks: + +1. **Install pre-commit** (if not already installed): + ```bash + pip install pre-commit + ``` +2. **Install the git hooks** in the repository: + ```bash + pre-commit install + ``` + +Once installed, `pyink` will automatically run on and format any files you +modify whenever you run `git commit`. + +If you prefer to run it manually without committing, you can use: +```bash +pixi run -e tests pyink --check . +``` +(Or specify individual files to check instead of `.`). + ### Running tests The Xee integration tests only pass on Xee branches (no forks). Please run the