Commit 68559f1
authored
ci: run pre-commit on pull requests (#18)
## What / why
This repo ships a `.pre-commit-config.yaml` whose hooks were not
consistently enforced. This PR makes the pre-commit hooks run reliably
in CI and green.
## Changes
### 1. `ci: skip: [go-fmt, go-vet]` in `.pre-commit-config.yaml`
This is the key fix. Go formatting/vetting is **already enforced by the
golangci-lint workflow (`lint.yml`)**, and the
`dnephin/pre-commit-golang` **`go-vet` hook is broken for this repo's
layout** — it fails with `no Go files in <root>` because the packages
live in subdirectories under a single root `go.mod`. Skipping both Go
hooks on pre-commit.ci makes that status green; Go quality stays covered
by golangci-lint.
### 2. A native `pre-commit` GitHub Actions workflow
Runs `uvx pre-commit run --all-files --show-diff-on-failure` via
`astral-sh/setup-uv` on PRs and pushes to `main` (pre-commit.ci only
covers PRs). Read-only, SHA-pinned, caches `~/.cache/pre-commit`. It
uses `SKIP: go-fmt,go-vet` for the same reason as above. (If you'd
rather rely solely on pre-commit.ci, this workflow can be dropped — the
`ci: skip` change above is the essential part.)
### 3. check-yaml multi-document support
Added `args: [--allow-multiple-documents]` — the repo's k8s manifests
(`config/manager/manager.yaml`, `deploy/install.yaml`,
`examples/git-sync-sidecar/notebook.yaml`) are valid multi-document YAML
that the default hook rejected.
### 4. Mechanical hook autofixes (previously unenforced)
- **ruff (auto):** removed unused imports (`F401`) in
`plugin/examples/with-cw.py`, `plugin/tests/test_status.py`; removed
extraneous f-string prefixes (`F541`) in
`plugin/kubectl_marimo/deploy.py`.
- **ruff (manual, trivial):** dropped an unused `mock_echo` assignment
(`F841`) in `plugin/tests/test_deploy.py` (kept the `mocker.patch(...)`
call).
- **whitespace/EOF fixers:** trailing blank line in
`.devcontainer/devcontainer.json`, missing trailing newline in
`hack/boilerplate.go.txt`.
### Verification (local, Go hooks skipped as scoped)
```
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...............................................................Passed
check for merge conflicts................................................Passed
ruff.....................................................................Passed
ruff-format..............................................................Passed
go fmt..................................................................Skipped
go vet..................................................................Skipped
```
Part of the marimo-team engineering-excellence initiative to make sure
every repo's declared quality gates actually run — and pass — in CI.1 parent 0d06c2b commit 68559f1
8 files changed
Lines changed: 45 additions & 8 deletions
File tree
- .devcontainer
- .github/workflows
- hack
- plugin
- examples
- kubectl_marimo
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
3 | 10 | | |
4 | 11 | | |
5 | 12 | | |
6 | 13 | | |
7 | 14 | | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
0 commit comments