Skip to content

chore: unify pre-commit configuration across repositories - #135

Merged
gvatsal60 merged 2 commits into
masterfrom
chore/unify-pre-commit-config
Oct 4, 2026
Merged

gvatsal60 merged 2 commits into
masterfrom
chore/unify-pre-commit-config

Conversation

@gvatsal60

Copy link
Copy Markdown
Owner

Summary

Unifies .pre-commit-config.yaml to the canonical version managed in gvatsal60/.github.

The repositories in this account had drifted to 25 different pre-commit configurations, ranging from 8 to 23 hooks each. This change replaces every copy with the canonical superset so all repositories enforce an identical set of checks.

  • 30 hook repositories / 57 hooks, byte-identical to gvatsal60/.github
  • No check was removed: the canonical file is exactly the union of every hook that was active in any repository
  • Checks that previously existed in only a few repositories are now enforced everywhere, including ruff-check, ruff-format, pyupgrade, autopep8, isort, flake8, nbstripout, mypy, actionlint, shfmt, shellcheck, bashate, checkmake, gitleaks, talisman, sqlfluff-lint, sqlfluff-fix, rubocop, tf-fmt, tf-validate, clang-format, eslint, jshint, scss-lint, csslint, fixmyjs and the meta hook check-useless-excludes
  • google/yamlfmt v0.21.0 is retained for YAML formatting

Normalization applied

Only divergent arguments and revisions were normalized. Every hook still runs.

  • check-yaml now uses --allow-multiple-documents so repositories containing multi-document YAML keep passing
  • bashate runs with default arguments
  • sqlfluff-lint and sqlfluff-fix run with default arguments; dialect-specific configuration belongs in a repository-level .sqlfluff file
  • ruff-check uses --fix --unsafe-fixes
  • pretty-format-json uses --autofix and excludes *.ipynb; check-json excludes *.ipynb
  • Pinned revisions standardized to shellcheck-py v0.11.0.1, checkmake v0.3.2, gitleaks v8.30.1

Known interactions

  • The Python toolchain (ruff-format, autopep8, flake8, ruff-check, pyupgrade, isort) now runs in every repository. ruff-format and flake8/autopep8 can disagree on line length, so the first run may reformat Python files.
  • check-useless-excludes will report the *.ipynb excludes as useless in repositories that contain no notebooks.
  • detect-aws-credentials remains disabled, matching the canonical configuration.

Validation

  • All copies are byte-identical (sha256 dc1572904755b412337165b69c9dc8f6b875aa3f0573f9105ec17c699b2424d7)
  • The hook set was diffed against the union of all previous configurations: 57 present before, 57 present after, 0 removed
  • YAML parses cleanly, every hook block defines repo, rev and hooks, and there are no duplicate repository/id pairs

Checklist

  • The change is well-scoped and ready for review
  • I validated the touched files locally or with the available checks
  • Any downstream impact is documented in the PR description

Copilot AI balanced review requested due to automatic review settings October 4, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

@gvatsal60 gvatsal60 self-assigned this Oct 4, 2026
Comment thread .pre-commit-config.yaml
hooks:
- id: ruff-check
args: [--fix, --unsafe-fixes]
- id: ruff-format

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Five overlapping auto-fixers now run on the same Python files in one pre-commit pass

ruff-check --fix --unsafe-fixes (line 47), ruff-format (49), pyupgrade (63), autopep8 (68) and isort (74) all mutate the same files. pre-commit aborts the run as soon as a hook rewrites a file, and these tools do not agree by default (autopep8 reformats what ruff-format produced, isort and ruff's I001 rules sort differently), so every commit touching Python can need several manual re-commit rounds and may never settle.

Recommendation: keep a single formatter (ruff-format) plus one import sorter, and move the redundant fixers (autopep8, pyupgrade, isort) to their own opt-in config rather than the canonical shared file.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread .pre-commit-config.yaml
- repo: https://github.com/pycqa/flake8
rev: "7.4.1"
hooks:
- id: flake8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: flake8 defaults conflict with ruff-format (79 vs 88 columns)

ruff-format formats to a 88-character line length, while flake8 with no arguments and no config file (there is no setup.cfg, tox.ini, or .flake8 in this repository) reports E501 for any line longer than 79 characters. In any repository that contains Python files this makes the newly added flake8 hook fail on code that ruff-format just produced, so the two hooks can never both pass.

Either pin them to the same width, e.g.

      - id: flake8
        args: [--max-line-length=88]

or drop flake8 from the canonical set since ruff-check already covers most of what it reports.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread .pre-commit-config.yaml
- repo: https://github.com/sqlfluff/sqlfluff
rev: "4.3.0"
hooks:
- id: sqlfluff-lint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: sqlfluff will error out because no dialect is configured

Neither hook here passes --dialect, and this repository has no .sqlfluff config file. sqlfluff refuses to lint a file without a dialect and exits non-zero with No dialect was specified, so the moment a .sql file is added (and this config is being rolled out fleet-wide, so some of the target repositories do have SQL), both sqlfluff-lint and sqlfluff-fix fail instead of reporting lint violations.

Add a repository-level .sqlfluff, or pass the dialect explicitly:

      - id: sqlfluff-lint
        args: [--dialect, ansi]

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread .pre-commit-config.yaml
rev: "4.3.0"
hooks:
- id: sqlfluff-lint
- id: sqlfluff-fix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SUGGESTION: Run sqlfluff-fix before sqlfluff-lint

pre-commit executes hooks in declaration order, so linting happens against the unfixed sources and every violation that the fixer would have resolved still fails the run, forcing an unnecessary re-commit. Swapping the two ids makes the fix land first and the lint pass verify the result.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
.pre-commit-config.yaml 49 Five overlapping auto-fixers (ruff-check --fix, ruff-format, pyupgrade, autopep8, isort) rewrite the same Python files in one run; hooks disagree by default so runs fail repeatedly and may never converge
.pre-commit-config.yaml 79 flake8 default max-line-length=79 conflicts with ruff-format (88 columns) and no setup.cfg/tox.ini/.flake8 exists, so E501 fails on ruff-formatted code
.pre-commit-config.yaml 164 sqlfluff-lint/sqlfluff-fix have no --dialect and no .sqlfluff in the repo; sqlfluff exits non-zero with "No dialect was specified" on any SQL file

SUGGESTION

File Line Issue
.pre-commit-config.yaml 165 sqlfluff-lint is declared before sqlfluff-fix, so lint runs against unfixed sources and fails on violations the fixer resolves
Files Reviewed (1 files)
  • .pre-commit-config.yaml - 4 issues
Notes and assumptions
  • Reviewed the current HEAD a9a23bc, which includes the second commit that removed the repo: meta / check-useless-excludes block; that earlier potential schema issue is already fixed and is not reported.
  • Hook rev pins and hook id names were not validated against the upstream hook manifests, as no network access to those repositories was available in this environment.
  • This repository tracks no Python, SQL, Terraform, Ruby or JavaScript files, so the newly added hooks are inert here; the Python/SQL findings apply to the other repositories this canonical config is being rolled out to.
  • The new actionlint, gitleaks, detect-private-key, check-yaml --allow-multiple-documents and additional pre-commit-hooks entries were checked against this repository's tracked files and raise no issue.

Fix these issues in Kilo Cloud


Reviewed by free · Input: 53.2K · Output: 14.7K · Cached: 248K

@gvatsal60
gvatsal60 merged commit d4b3d96 into master Oct 4, 2026
12 checks passed
@gvatsal60
gvatsal60 deleted the chore/unify-pre-commit-config branch October 4, 2026 11:34
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.

2 participants