fix(envrc): correct hooks detection for worktrees and refresh tooling hints#598
fix(envrc): correct hooks detection for worktrees and refresh tooling hints#598
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Automated approval for maintainer PR
All automated quality gates passed. See SECURITY_CONTROLS.md for compensating controls.
There was a problem hiding this comment.
Code Review
This pull request updates the .envrc file to bump the required Go version to 1.26, improves Git hook detection for worktrees, and streamlines tool installation commands. It also removes hardcoded Go environment variables and simplifies the hook verification logic. Review feedback identifies several areas where these changes are incomplete or inconsistent with other project files, including missing updates for the Go version in error messages, gosec installation methods in the Makefile, worktree support in lefthook.yml, and hardcoded test coverage values.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #598 +/- ##
==========================================
- Coverage 87.28% 87.26% -0.02%
==========================================
Files 88 88
Lines 10631 10631
==========================================
- Hits 9279 9277 -2
- Misses 1112 1113 +1
- Partials 240 241 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the repo’s direnv bootstrap (.envrc) to better reflect current tooling expectations and to correctly detect lefthook-based git hooks in both regular repos and git worktrees.
Changes:
- Bump the required Go version hint to 1.26 to align with
go.mod. - Fix git hooks detection in worktrees by resolving the hooks path via
git rev-parse --git-path hooks. - Refresh developer tooling hints (e.g., gosec install) and remove hardcoded GOOS/GOARCH/CGO environment exports.
- .envrc:23 missed the Go-version bump message; align with REQUIRED_VERSION. - .envrc:30 numeric awk comparison treated 1.9 as >= 1.26; split major/minor and compare as integers. - .envrc:60 git rev-parse can fail (no git, not in a repo) and set -e would abort the whole .envrc; guard the call and skip the hooks check cleanly. - lefthook.yml:174 had the same `.git/hooks/pre-commit` hardcoded path that fails in worktrees; mirror the .envrc fix. - Makefile: drop the snap/securecodewarrior/gosec install hints (snap pkg doesn't exist; the repo URL is 404) and use `go install github.com/securego/gosec/v2/cmd/gosec@latest` consistently. - Makefile:300 still hardcoded "60.1%" coverage; replace with a pointer to `make test-coverage` so it can't drift. Addresses gemini-code-assist and Copilot review comments on PR #598. Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
There was a problem hiding this comment.
Automated approval for maintainer PR
All automated quality gates passed. See SECURITY_CONTROLS.md for compensating controls.
… hints The hooks check used a literal `.git/hooks/pre-commit` path, which fails in git worktrees (where `.git` is a file pointing to the worktree's gitdir). Replace with `git rev-parse --git-path hooks` so detection works for both regular repos and worktrees. While here: - Drop the dead Husky branch and the missing `install-husky.sh` reference (project migrated to lefthook; only `install-hooks.sh` remains). - Bump `REQUIRED_VERSION` from 1.25 to 1.26 to match `go.mod`. - Fix the `gosec` install hint (404 repo + non-existent snap package) to the canonical `go install github.com/securego/gosec/v2/cmd/gosec@latest`. - Stop forcing `CGO_ENABLED=0`, `GOOS=linux`, `GOARCH=amd64`. These belong in build commands, not a per-shell env: forcing CGO off silently breaks `go test -race`, and pinning GOOS/GOARCH breaks non-amd64 dev hosts. - Replace the hardcoded "60.1% coverage" claim with a pointer to `make test-coverage` so the help text doesn't drift. Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
- .envrc:23 missed the Go-version bump message; align with REQUIRED_VERSION. - .envrc:30 numeric awk comparison treated 1.9 as >= 1.26; split major/minor and compare as integers. - .envrc:60 git rev-parse can fail (no git, not in a repo) and set -e would abort the whole .envrc; guard the call and skip the hooks check cleanly. - lefthook.yml:174 had the same `.git/hooks/pre-commit` hardcoded path that fails in worktrees; mirror the .envrc fix. - Makefile: drop the snap/securecodewarrior/gosec install hints (snap pkg doesn't exist; the repo URL is 404) and use `go install github.com/securego/gosec/v2/cmd/gosec@latest` consistently. - Makefile:300 still hardcoded "60.1%" coverage; replace with a pointer to `make test-coverage` so it can't drift. Addresses gemini-code-assist and Copilot review comments on PR #598. Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
c3122ea to
2a1c593
Compare
|
There was a problem hiding this comment.
Automated approval for maintainer PR
All automated quality gates passed. See SECURITY_CONTROLS.md for compensating controls.



Summary
.git/hooks/pre-commitliterally, so it always reported "not configured" inside a git worktree (where.gitis a file). Switched togit rev-parse --git-path hooksso detection works for both regular repos and worktrees.install-husky.shreference (project already migrated to lefthook).REQUIRED_VERSION1.25 → 1.26 to matchgo.mod.gosecinstall hint (404 repo + non-existent snap pkg) to the canonicalgo install github.com/securego/gosec/v2/cmd/gosec@latest.CGO_ENABLED=0/GOOS=linux/GOARCH=amd64exports. These belong in build commands, not a per-shell env — forcing CGO off silently breaksgo test -race, and pinning GOOS/GOARCH breaks non-amd64 dev hosts.make test-coverageso it can't drift.Test plan
bash -n .envrcpasses✅ Git hooks configured (lefthook)instead of nagging