Add dev Makefile; format all markdown with prettier
Adds a minimal Makefile wrapping the toolchain the way sneak's other repos expose it: - fmt gofmt -w plus prettier (4-space tabs, proseWrap: always) - fmt-check fail if any Go or Markdown file is unformatted - lint golangci-lint run ./... - test go test ./... - check fmt-check + lint + test (the local pre-commit gate) Running make fmt normalizes the four existing Markdown docs to the shared prettier style (80-column proseWrap: always, aligned tables) — a one-time reflow with no content change. The repo remains exempt from the rest of the policy scaffold (no Dockerfile, CI, or REPO_POLICIES).
This commit is contained in:
35
Makefile
Normal file
35
Makefile
Normal file
@@ -0,0 +1,35 @@
|
||||
# Development convenience targets. This repo is exempt from the standard
|
||||
# policy scaffold (no Dockerfile, CI, or REPO_POLICIES.md); this Makefile
|
||||
# is only a thin wrapper around the Go toolchain, golangci-lint, and
|
||||
# prettier so `make fmt` / `make check` behave the same as in sneak's
|
||||
# other repos.
|
||||
|
||||
GO_PKGS := ./...
|
||||
MD_FILES := $(shell git ls-files '*.md')
|
||||
PRETTIER := prettier --tab-width 4 --prose-wrap always
|
||||
|
||||
.PHONY: check fmt fmt-check lint test
|
||||
|
||||
# Format, lint, and test — the full local pre-commit gate.
|
||||
check: fmt-check lint test
|
||||
|
||||
# Format Go and Markdown in place.
|
||||
fmt:
|
||||
gofmt -w .
|
||||
$(PRETTIER) --write $(MD_FILES)
|
||||
|
||||
# Fail if any Go or Markdown file is not formatted.
|
||||
fmt-check:
|
||||
@unformatted="$$(gofmt -l .)"; \
|
||||
if [ -n "$$unformatted" ]; then \
|
||||
echo "gofmt needed on:"; echo "$$unformatted"; exit 1; \
|
||||
fi
|
||||
$(PRETTIER) --check $(MD_FILES)
|
||||
|
||||
# Run the house linter (config in .golangci.yml).
|
||||
lint:
|
||||
golangci-lint run $(GO_PKGS)
|
||||
|
||||
# Run the test suite.
|
||||
test:
|
||||
go test $(GO_PKGS)
|
||||
Reference in New Issue
Block a user