Skip to content

fix: add pre-commit.ci configuration for automated linting#16

Merged
abhizipstack merged 2 commits intomainfrom
fix/pre-commit-ci-setup
Apr 1, 2026
Merged

fix: add pre-commit.ci configuration for automated linting#16
abhizipstack merged 2 commits intomainfrom
fix/pre-commit-ci-setup

Conversation

@abhizipstack
Copy link
Copy Markdown
Contributor

@abhizipstack abhizipstack commented Mar 31, 2026

What

  • Add ci configuration section to .pre-commit-config.yaml to support pre-commit.ci integration
  • Skip hooks that don't work in CI sandbox (mypy, protolint-docker, hadolint-docker)
  • Enable autofix PRs and monthly autoupdate schedule

Why

  • Automate linting checks on PRs via pre-commit.ci
  • mypy uses language: system (not available in CI sandbox), Docker-based hooks need Docker (unavailable in CI)
  • Auto-fix PRs reduce manual lint fixes, monthly autoupdate keeps hook versions current

How

  • Added ci: block to .pre-commit-config.yaml with skip, autofix_prs: true, and autoupdate_schedule: monthly

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. This only adds CI configuration metadata to the pre-commit config file. It does not affect local pre-commit hook behavior or any application code.

Database Migrations

  • None

Env Config

  • None

Relevant Docs

Related Issues or PRs

  • N/A

Dependencies Versions

  • None

Notes on Testing

  • After merge, enable pre-commit.ci at https://pre-commit.ci/ for Zipstack/visitran
  • Add pre-commit.ci - pr as a required status check in branch protection

Screenshots

N/A

Checklist

Add ci section to .pre-commit-config.yaml:
- Skip hooks that don't work in CI: no-commit-to-branch, mypy (system),
  protolint-docker, hadolint-docker
- Enable autofix PRs
- Set monthly autoupdate schedule

After merging, enable pre-commit.ci at https://pre-commit.ci/ for this
repo and add "pre-commit.ci - pr" as a required status check.

Jira: OR-1356

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Mar 31, 2026

Greptile Summary

This PR adds a ci: configuration block to .pre-commit-config.yaml to enable pre-commit.ci integration for the repository. The configuration correctly skips hooks that cannot run in the pre-commit.ci sandbox (mypy with language: system, and the two Docker-dependent linters), enables autofix PRs, and sets a monthly autoupdate schedule.

Key observations:

  • The three skipped hooks (mypy, protolint-docker, hadolint-docker) are correctly identified — mypy uses language: system (no isolated env), and Docker-based hooks simply cannot run in pre-commit.ci.
  • The PR description names no-commit-to-branch as a hook to skip, but it is not included in the actual ci.skip list. Since pre-commit.ci auto-fix commits target the PR branch (not main), the hook likely won't interfere in practice, but the description/code mismatch is worth clarifying.
  • autofix_prs: true and autoupdate_schedule: monthly are valid pre-commit.ci settings with no issues.

Confidence Score: 5/5

Safe to merge; the CI configuration is functionally correct and the only finding is a minor description/code mismatch that does not affect runtime behavior.

All remaining findings are P2 — the omission of no-commit-to-branch from the skip list does not cause a functional defect since pre-commit.ci auto-fix pushes target PR branches, not main. The three explicitly skipped hooks are correctly justified. No logic errors, no security concerns.

No files require special attention.

Important Files Changed

Filename Overview
.pre-commit-config.yaml Adds a ci: section for pre-commit.ci integration; skips three hooks with environment constraints (mypy, protolint-docker, hadolint-docker), but no-commit-to-branch is mentioned in the PR description as a skip candidate yet is absent from the list.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer pushes commit to PR branch] --> B[pre-commit.ci triggered]
    B --> C{Run configured hooks}
    C --> D[Skipped: mypy\nlanguage: system]
    C --> E[Skipped: protolint-docker\nneeds Docker]
    C --> F[Skipped: hadolint-docker\nneeds Docker]
    C --> G[Run: all other hooks\nblack, isort, flake8, etc.]
    G --> H{Hooks pass?}
    H -- Yes --> I[CI check passes]
    H -- No --> J[pre-commit.ci creates\nautofix commit to PR branch]
    J --> K[no-commit-to-branch runs\nagainst PR branch, NOT main\nso it does NOT block]
    K --> I
    B2[autoupdate job - monthly] --> L[pre-commit.ci opens\nautoupdate PR against repo]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .pre-commit-config.yaml
Line: 5-11

Comment:
**`no-commit-to-branch` omitted from skip list despite PR description**

The PR description explicitly lists `no-commit-to-branch` as a hook to skip (explaining that "CI auto-fix pushes to PR branches"), but it is absent from the `ci.skip` list.

In practice this may be harmless — pre-commit.ci's auto-fix commits target the PR branch, not `main`, so the hook (configured with `--branch main`) won't fire for those commits. However, if pre-commit.ci ever runs against a push directly to `main` (e.g. during the `autoupdate` workflow or admin pushes), it will fail. Whether that's intentional enforcement or an oversight is worth confirming, given the description says it should be skipped.

If the intent is to keep it active in CI (to catch direct pushes to `main`), update the PR description to remove it from the listed skips. If it should be skipped for consistency with the description, add it:

```suggestion
ci:
  skip:
    - no-commit-to-branch # Blocks CI auto-fix commits; auto-fix pushes to PR branches anyway
    - mypy # Uses language: system, not available in pre-commit.ci sandbox
    - protolint-docker # Needs Docker, not available in pre-commit.ci
    - hadolint-docker # Needs Docker, not available in pre-commit.ci
  autofix_prs: true
  autoupdate_schedule: monthly
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "fix: remove no-commit-to-branch from ci ..." | Re-trigger Greptile

no-commit-to-branch only blocks commits to main — pre-commit.ci
runs on PR branches so it passes naturally. Keep skip for hooks
that genuinely need Docker or system Python.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@wicky-zipstack wicky-zipstack left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@tahierhussain tahierhussain left a comment

Choose a reason for hiding this comment

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

LGTM

@abhizipstack abhizipstack merged commit 6974a75 into main Apr 1, 2026
1 check passed
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