feat: generate pre-commit hooks in scaffolded repos#42
Merged
Conversation
Every repo created by gostrap init now includes a .pre-commit-config.yaml with three validation layers: - check-yaml: YAML syntax validation (skips Go/Helm templates) - kubeconform: Kubernetes manifest schema validation (skips CRDs like Application, Kustomization, HelmRelease, SealedSecret, etc.) - gostrap validate: full structural integrity check Also includes trailing-whitespace, end-of-file-fixer, and check-merge-conflict hooks for general hygiene. Includes 5 unit tests covering generation, idempotency, template exclusion patterns, Flux repo support, and CRD skip list. Updates README with pre-commit documentation section, generated repo structure, and project structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gostrap initnow includes a.pre-commit-config.yamlwith three validation layers:trailing-whitespace,end-of-file-fixer, andcheck-merge-conflicthooksCloses #22
Test plan
go test -race ./...— all tests passgolangci-lint run— 0 issuesgostrap initgenerates.pre-commit-config.yamlin the scaffolded repogostrap initon existing repo skips the file (idempotent)