From 33d56186e4fd114f83b141f146cdbce102d068fa Mon Sep 17 00:00:00 2001 From: Shilpa Chugh Date: Wed, 27 May 2026 12:30:55 +0530 Subject: [PATCH] docs(agents): add targeted lint/format commands to AGENTS.md Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Shilpa Chugh --- AGENTS.md | 17 +++++++++++++++++ Makefile | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 7391acd8a8..1a22f6b7fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -128,6 +128,23 @@ make vet # Vet the Go code make golangci-lint # Verify the Go code ``` +### Targeted lint/format + +For quick feedback on specific files or packages instead of running project-wide `make` targets: + +```bash +# Go +make golangci-lint LINT_PKG=./pkg/controller/... # Lint a single Go package +go vet ./pkg/controller/... # Vet a single Go package (package-level) +gofmt -w path/to/file.go # Format a single Go file + +# Python +pre-commit run --files path/to/file.py # Run all hooks on a single file + +# Rust (crate-level: triggers on the file but formats/checks the entire crate) +pre-commit run --files path/to/file.rs # Run all hooks on a single file +``` + **Code generation** (always run after modifying the APIs): ```bash diff --git a/Makefile b/Makefile index e474cad909..76dbda5dcf 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ HELM_DOCS ?= $(LOCALBIN)/helm-docs YQ ?= $(LOCALBIN)/yq GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint GOLANGCI_LINT_KAL ?= $(LOCALBIN)/golangci-lint-kube-api-linter +LINT_PKG ?= ./... KUBE_LINTER ?= $(LOCALBIN)/kube-linter ##@ General @@ -173,7 +174,7 @@ vet: ## Run go vet against the code. .PHONY: golangci-lint golangci-lint: golangci-lint-install golangci-lint-kal ## Run golangci-lint to verify Go files. - $(GOLANGCI_LINT) run --timeout 5m ./... + $(GOLANGCI_LINT) run --timeout 5m $(LINT_PKG) $(GOLANGCI_LINT_KAL) run -v --config $(PROJECT_DIR)/.golangci-kal.yml .PHONY: verify-boilerplate