Skip to content

fix(lint): run CI-parity lint check at pre-commit, not just pre-push - #886

Open
skevetter wants to merge 4 commits into
mainfrom
chore/lint-parity-pre-commit
Open

fix(lint): run CI-parity lint check at pre-commit, not just pre-push#886
skevetter wants to merge 4 commits into
mainfrom
chore/lint-parity-pre-commit

Conversation

@skevetter

@skevetter skevetter commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Runs the existing golangci-lint-ci-parity hook (task cli:lint:ci, which mirrors CI's --new-from-patch diff-vs-origin/main behavior) at pre-commit in addition to pre-push, so CI-breaking issues (e.g. formatter violations) are caught before the first commit rather than only at push time.
  • Removes the plain golangci-lint hook, which lints entire packages with no diff scoping and surfaces pre-existing, unrelated findings on any touched file — noisy and not representative of what CI actually enforces.

Verified locally: reverting to a pre-fix commit and re-running pre-commit run golangci-lint-ci-parity --hook-stage pre-commit reproduces the exact golines failure PR #885's CI hit; with the fix applied, the hook passes.

Summary by CodeRabbit

  • Chores
    • Improved automated code-quality checks by aligning the Go setup with the project configuration.
    • Updated pre-commit checks to run consistently during both commits and pushes.
    • Simplified linting workflow configuration and added the latest Task CLI to the validation process.

Removes the plain golangci-lint hook, which lints whole packages and
surfaces pre-existing findings unrelated to the diff. The
golangci-lint-ci-parity hook already reproduces CI's exact
new-from-patch behavior via `task cli:lint:ci`; running it at
pre-commit (in addition to pre-push) catches CI-breaking issues like
formatter violations before they're pushed.
@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit a2efd16
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a72fe71a3515700085c4ebd

@netlify

netlify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit a2efd16
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a72fe71266db90008fe3c83

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cd212e0-97d7-4121-884a-86ddc6403b5f

📥 Commits

Reviewing files that changed from the base of the PR and between 821cdbb and a2efd16.

📒 Files selected for processing (1)
  • .github/workflows/pr-ci.yml
📝 Walkthrough

Walkthrough

The pre-commit CI job now sets up Go from go.mod and installs Task. The standalone golangci-lint hook is removed. The parity hook now runs during both pre-commit and pre-push.

Changes

Pre-commit CI updates

Layer / File(s) Summary
Pre-commit toolchain setup
.github/workflows/pr-ci.yml
The precommit job sets up Go from go.mod and installs the latest Task CLI.
Lint parity hook stages
.pre-commit-config.yaml
The standalone golangci-lint hook and timeout are removed. golangci-lint-ci-parity runs at pre-commit and pre-push stages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: running the CI-parity lint check during pre-commit instead of only pre-push.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The golangci-lint-ci-parity hook now runs at the pre-commit stage,
but the Pre-commit CI job (j178/prek-action) never installed the
task CLI it depends on, causing task cli:lint:ci to fail with
"No such file or directory".
@github-actions github-actions Bot added size/s and removed size/xs labels Aug 5, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/pr-ci.yml (1)

49-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin the Task CLI version used by CI.

@latest selects a changing upstream release. A new release can change Task behavior or toolchain requirements, so CI can change without a repository commit. Use a tested exact v3.x.y version and update it deliberately. Go supports both latest and version-specific module installation. (go.dev)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-ci.yml at line 49, Update the Task CLI installation
command in the CI workflow to use a tested exact v3.x.y version instead of
`@latest`, preserving the existing go install invocation and allowing future
version changes only through deliberate commits.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.pre-commit-config.yaml:
- Line 68: The pre-commit stage currently invokes the lint task that
unconditionally runs git fetch, blocking commits without network access. Update
the hook configuration around the stages entry so Go linting in pre-commit uses
a local or cached base without fetching, while retaining the fetch-dependent
validation in pre-push or CI.

---

Nitpick comments:
In @.github/workflows/pr-ci.yml:
- Line 49: Update the Task CLI installation command in the CI workflow to use a
tested exact v3.x.y version instead of `@latest`, preserving the existing go
install invocation and allowing future version changes only through deliberate
commits.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fe93d263-cde1-40f4-be42-1b39cf8e65b3

📥 Commits

Reviewing files that changed from the base of the PR and between 66965cf and 821cdbb.

📒 Files selected for processing (2)
  • .github/workflows/pr-ci.yml
  • .pre-commit-config.yaml

Comment thread .pre-commit-config.yaml
types: [go]
pass_filenames: false
stages: [pre-push]
stages: [pre-commit, pre-push]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Avoid an unconditional network fetch in the pre-commit path.

This stage now runs task cli:lint:ci during pre-commit. That Taskfile task executes git fetch --quiet origin main before linting. Developers without network access, valid Git credentials, or an origin/main branch will be unable to create commits that change Go files.

Keep the fetch in the pre-push or CI path, or provide a pre-commit path that uses a cached base with an explicit stale-base policy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.pre-commit-config.yaml at line 68, The pre-commit stage currently invokes
the lint task that unconditionally runs git fetch, blocking commits without
network access. Update the hook configuration around the stages entry so Go
linting in pre-commit uses a local or cached base without fetching, while
retaining the fetch-dependent validation in pre-push or CI.

golangci-lint-ci-parity's git merge-base HEAD origin/main needs
shared commit history, but actions/checkout defaults to a shallow
clone, so the hook failed with "unknown revision or path not in
the working tree" in the Pre-commit job.
golangci-lint-fmt installs its own private golangci-lint copy for
that hook only, but the system-language golangci-lint-ci-parity
hook invokes the golangci-lint binary directly and needs it on
PATH, which the Pre-commit job never provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant