This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build
make bin # fmt + vet + build to bin/kubectl-view-quotas
# Test
make test # runs tests with coverage (go test ./pkg/... ./cmd/...)
# Format & Vet
make fmt
make vet
# Lint (via pre-commit)
golangci-lint runRun a single test:
go test ./pkg/plugin/... -run TestFunctionName -vThis is a kubectl plugin (installed via krew) that lists Kubernetes ResourceQuota objects with color-coded usage percentages.
Entry point flow:
cmd/plugin/main.go→cli.InitAndExecute()cmd/plugin/cli/root.go— Cobra command setup; wiresgenericclioptions.ConfigFlags(standard kubectl flags) and the--all-namespaces/-Aflag; callsplugin.RunPlugin()pkg/plugin/plugin.go— Core logic: builds a k8s clientset from kubeconfig, listsResourceQuotaobjects in the target namespace(s), and prints a colored table viauitable+cfmt
Color coding in chooseColour(): usage percentage maps to a gradient from white (0–10%) through green shades, then yellow/orange/red at higher thresholds (100% = #FF0000).
golangci-lint is configured in .golangci.yaml. Active linters include gofumpt, goimports, gosec, revive, gocritic, errcheck, and others. Tag naming rules: YAML fields use goCamel, JSON fields use snake_case. ioutil.* usage is forbidden (use io / os equivalents).
Pre-commit hook runs golangci-lint automatically (.pre-commit-config.yaml).
.goreleaser.yml handles cross-platform builds. .krew.yaml defines the krew plugin manifest for distribution via kubectl krew.