chore: add pre-commit guardrails #6

Merged
Noel merged 3 commits from feat/pre-commit-hooks into main 2026-10-18 17:25:59 +00:00
Owner
  • gitleaks: block secrets before they enter history
  • pre-commit-hooks: whitespace/eof hygiene, yaml/json/toml checks,
    merge-conflict markers, large files, private keys
  • commitizen (commit-msg stage): enforce conventional commits so
    release-please always sees releaseable messages
  • actionlint: validate workflow files offline
  • eslint --fix on staged files (local hook, needs pnpm install)
- gitleaks: block secrets before they enter history - pre-commit-hooks: whitespace/eof hygiene, yaml/json/toml checks, merge-conflict markers, large files, private keys - commitizen (commit-msg stage): enforce conventional commits so release-please always sees releaseable messages - actionlint: validate workflow files offline - eslint --fix on staged files (local hook, needs pnpm install)
Noel added 1 commit 2026-10-18 16:17:35 +00:00
chore: add pre-commit guardrails
PR Check / Dockerfile lint (droast) (pull_request) Skipped
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 34s
PR Check / Typecheck (pull_request) Successful in 37s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 8s
PR Check / AI code review (opencode) (pull_request) Failing after 11s
ab7626d5f7
- gitleaks: block secrets before they enter history
- pre-commit-hooks: whitespace/eof hygiene, yaml/json/toml checks,
  merge-conflict markers, large files, private keys
- commitizen (commit-msg stage): enforce conventional commits so
  release-please always sees releaseable messages
- actionlint: validate workflow files offline
- eslint --fix on staged files (local hook, needs pnpm install)
Noel added 1 commit 2026-10-18 16:25:26 +00:00
Merge branch 'main' into feat/pre-commit-hooks
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 35s
PR Check / Typecheck (pull_request) Successful in 38s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 5s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Failing after 5s
PR Check / AI code review (opencode) (pull_request) Successful in 1m19s
8fa8eb63b2
Author
Owner



build · deepseek-v4-pro
→ Read .pr-review-diff.patch
build · deepseek-v4-pro
→ Read .pr-review-diff.patch [offset=80]
build · deepseek-v4-pro
[BLOCKER] .pre-commit-config.yaml:63 - entry: bash -c 'pnpm exec eslint --fix' is broken. pre-commit (system hooks) appends staged filenames as args, but bash -c 'cmd' assigns the first filename to $0 and discards the rest — eslint receives zero file arguments. Consequences: (1) eslint lints the entire repo instead of staged files, contradicting the hook's stated purpose ("only staged files are linted (fast)"); (2) --fix silently rewrites files that are not part of your commit — pre-commit only detects modifications to files it passed, so unstaged fixes slip into your working tree unnoticed and get swept into the next unrelated commit; (3) lint errors in other people's unstaged WIP block your commit. Fix: entry: pnpm exec eslint --fix (pre-commit passes filenames directly, no shell) or entry: bash -c 'pnpm exec eslint --fix "$@"' --.

[NIT] .pre-commit-config.yaml:66 - types: [file] matches every file type, making it redundant alongside the files regex; drop it (or use real tags like types: [javascript]) so intent is clear.

[NIT] .pre-commit-config.yaml:69 - Even with the entry fixed, --fix will cause pre-commit to abort commits with "files were modified by this hook" whenever a fix is applied, forcing a re-stage loop on every autofixable commit. Consider leaving --fix out and letting CI lint, or document the re-stage workflow.

Otherwise the diff is a single new .pre-commit-config.yaml; pinning, stages, and file regexes are correct.

VERDICT: REQUEST_CHANGES

 > build · deepseek-v4-pro → Read .pr-review-diff.patch > build · deepseek-v4-pro → Read .pr-review-diff.patch [offset=80] > build · deepseek-v4-pro [BLOCKER] .pre-commit-config.yaml:63 - `entry: bash -c 'pnpm exec eslint --fix'` is broken. pre-commit (system hooks) appends staged filenames as args, but `bash -c 'cmd'` assigns the first filename to `$0` and discards the rest — eslint receives zero file arguments. Consequences: (1) eslint lints the entire repo instead of staged files, contradicting the hook's stated purpose ("only staged files are linted (fast)"); (2) `--fix` silently rewrites files that are not part of your commit — pre-commit only detects modifications to files it passed, so unstaged fixes slip into your working tree unnoticed and get swept into the next unrelated commit; (3) lint errors in other people's unstaged WIP block your commit. Fix: `entry: pnpm exec eslint --fix` (pre-commit passes filenames directly, no shell) or `entry: bash -c 'pnpm exec eslint --fix "$@"' --`. [NIT] .pre-commit-config.yaml:66 - `types: [file]` matches every file type, making it redundant alongside the `files` regex; drop it (or use real tags like `types: [javascript]`) so intent is clear. [NIT] .pre-commit-config.yaml:69 - Even with the entry fixed, `--fix` will cause pre-commit to abort commits with "files were modified by this hook" whenever a fix is applied, forcing a re-stage loop on every autofixable commit. Consider leaving `--fix` out and letting CI lint, or document the re-stage workflow. Otherwise the diff is a single new `.pre-commit-config.yaml`; pinning, stages, and file regexes are correct. VERDICT: REQUEST_CHANGES
Noel added 1 commit 2026-10-18 17:25:09 +00:00
fix: pass staged filenames to the eslint pre-commit hook
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 35s
PR Check / Typecheck (pull_request) Canceled after 15s
PR Check / Secret scan (gitleaks) (pull_request) Canceled after 0s
PR Check / Dependency audit (pull_request) Canceled after 0s
PR Check / Dockerfile lint (droast) (pull_request) Canceled after 0s
PR Check / AI code review (opencode) (pull_request) Canceled after 0s
81d658a871
Validated from review comment 82 on this PR: the 'bash -c' wrapper
consumed the first staged filename as $0 and the command never
referenced $@, so eslint received zero file arguments and linted the
whole repo - --fix silently rewrote unstaged files and WIP lint errors
blocked unrelated commits. The entry now receives filenames directly
from pre-commit (empirically verified with an arg probe); documented
the re-stage loop for --fix and dropped the redundant 'types: [file]'
filter.
Noel merged commit f13fc7668c into main 2026-10-18 17:25:59 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CV_Website/CV_Site_Nuxt#6