Skip to content

ci: run pre-commit on pull requests - #18

Merged
dmadisetti merged 2 commits into
mainfrom
ci/run-pre-commit
Jul 22, 2026
Merged

ci: run pre-commit on pull requests#18
dmadisetti merged 2 commits into
mainfrom
ci/run-pre-commit

Conversation

@mscolnick

@mscolnick mscolnick commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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.

Add a pre-commit CI workflow, apply mechanical hook autofixes (ruff F401/F541, whitespace/EOF), remove an unused test variable, and allow multi-document YAML in check-yaml. Go hooks are scoped out (already covered by golangci-lint).
Copilot AI review requested due to automatic review settings July 22, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mscolnick
mscolnick requested a review from dmadisetti July 22, 2026 14:39
@dmadisetti
dmadisetti merged commit 68559f1 into main Jul 22, 2026
11 checks passed
@dmadisetti
dmadisetti deleted the ci/run-pre-commit branch July 22, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants