mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-16 11:49:06 +02:00
AGENTS.md forbids attribution trailers, but a rule an agent has to go and read loses to the instruction it is handed every turn. CLAUDE.md now imports AGENTS.md so it is always in context; a commit-msg hook (via make setup-hooks) refuses the trailers at commit time; a CodeRabbit pre-merge check flags a PR whose description or commits carry them. The check reports rather than blocks, since the repository keeps CodeRabbit's request-changes workflow off; turning that on is a separate, repository-wide decision.
40 lines
1.6 KiB
Makefile
40 lines
1.6 KiB
Makefile
.PHONY: lint lint-all lint-install setup-hooks test-unit test-privileged
|
|
GOLANGCI_LINT := $(shell pwd)/bin/golangci-lint
|
|
|
|
# Install golangci-lint locally if needed
|
|
$(GOLANGCI_LINT):
|
|
@echo "Installing golangci-lint..."
|
|
@mkdir -p ./bin
|
|
@GOBIN=$(shell pwd)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
|
|
|
|
# Lint only changed files (fast, for pre-push)
|
|
lint: $(GOLANGCI_LINT)
|
|
@echo "Running lint on changed files..."
|
|
@$(GOLANGCI_LINT) run --new-from-rev=origin/main --timeout=2m
|
|
|
|
# Lint entire codebase (slow, matches CI)
|
|
lint-all: $(GOLANGCI_LINT)
|
|
@echo "Running lint on all files..."
|
|
@$(GOLANGCI_LINT) run --timeout=12m
|
|
|
|
# Just install the linter
|
|
lint-install: $(GOLANGCI_LINT)
|
|
|
|
# Setup git hooks for all developers
|
|
setup-hooks:
|
|
@git config core.hooksPath .githooks
|
|
@chmod +x .githooks/pre-push .githooks/commit-msg
|
|
@echo "✅ Git hooks configured! Pre-push runs 'make lint'; commit-msg refuses attribution trailers"
|
|
|
|
# Host-safe unit tests: excludes the privileged-tagged tests (root / system-mutating).
|
|
# Runs as a normal user with no sudo and leaves host networking untouched.
|
|
test-unit:
|
|
@go test -tags devcert -timeout 10m ./...
|
|
|
|
# Privileged suite: runs the `privileged`-tagged tests inside a --privileged
|
|
# --cap-add=NET_ADMIN container via the ory/dockertest harness. Requires Docker.
|
|
# Narrow the run with env vars, e.g.:
|
|
# PRIV_RUN=TestNftablesManager PRIV_PKGS=./client/firewall/nftables/... make test-privileged
|
|
test-privileged:
|
|
@go test -tags 'devcert privileged' -timeout 30m -run TestRunPrivilegedSuiteInDocker -v ./client/testutil/privileged/...
|