Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
default_install_hook_types: [pre-commit, commit-msg]

repos:
# Secret scanning (VPN-free, open-source alternative to rh-pre-commit)
- repo: https://github.com/leaktk/leaktk
rev: e62a495260dc1e396fa586e51bbe1355f6fc7d9d # v0.3.3
hooks:
- id: leaktk.git.pre-commit

# HyperFleet code quality hooks
- repo: https://github.com/openshift-hyperfleet/hyperfleet-hooks
rev: 7f5119208e5cdee3f0c688881b6a4b803095f203 # v0.2.1
hooks:
- id: hyperfleet-commitlint
stages: [commit-msg]
- id: hyperfleet-gofmt
- id: hyperfleet-golangci-lint
- id: hyperfleet-go-vet

# File hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
22 changes: 21 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Event-driven Kubernetes resource manager. Consumes CloudEvents from a message br

Go 1.25.0 · Cobra CLI · Viper config · golangci-lint (bingo-managed) · Tekton CI (Konflux)

## Setup (fresh clone)

```bash
make install-hooks # Install pre-commit hooks (secret scanning, linting, etc.)
make build # Build binary → bin/hyperfleet-adapter
```

## Verification Checklist

```bash
Expand All @@ -14,7 +21,20 @@ make test-integration # Integration tests via testcontainers (needs Docker/Podma
make build # Build binary → bin/hyperfleet-adapter
```

`make test-all` runs all of the above plus `make test-helm`. Pre-commit hooks: `make install-hooks`.
`make test-all` runs `make lint`, `make test`, `make test-integration`, and `make test-helm`.

### Pre-commit Hooks
Install: `make install-hooks`

Hooks:
- `leaktk.git.pre-commit` — secret scanning (open-source, no VPN required)
- `hyperfleet-commitlint` — validates commit message format (commit-msg stage)
- `hyperfleet-gofmt` — Go code formatting
- `hyperfleet-golangci-lint` — linting
- `hyperfleet-go-vet` — Go vet checks
- `trailing-whitespace` — removes trailing whitespace
- `end-of-file-fixer` — ensures files end with newline
- `check-added-large-files` — prevents large files from being committed

## CLI

Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,17 @@ test-helm: $(KUBECONFORM) verify-helm-docs ## Test Helm charts (lint, template,

##@ Code Quality

.PHONY: install-hooks
install-hooks: ## Install pre-commit hooks
pre-commit install

.PHONY: fmt
fmt: $(GOIMPORTS) ## Format code with goimports
$(GOIMPORTS) -w .

.PHONY: gofmt
gofmt: fmt ## Alias for fmt

.PHONY: fmt-check
fmt-check: ## Check if code is formatted
@diff=$$($(GOFMT) -s -d .); \
Expand All @@ -341,6 +348,9 @@ fmt-check: ## Check if code is formatted
vet: ## Run go vet
$(GO) vet ./...

.PHONY: go-vet
go-vet: vet ## Alias for vet

.PHONY: lint
lint: $(GOLANGCI_LINT) ## Run golangci-lint
$(GOLANGCI_LINT) run
Expand Down