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
9 changes: 5 additions & 4 deletions .agents/skills/code-style/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ Generated code follows this rule too, read in the output, not in the template:
- **Complete assertions**: one `assert.Equal` on the whole value over field-by-field checks.
- **Test file mirrors source**: `foo.go` is tested in `foo_test.go`. No orphan test files.
- **Fixtures** for specs live in `testdata/` next to the test; keep each fixture minimal.
- **Coverage**: every package passes the 100% gate (`make cover-check`). Exclusions go in
`.covignore` with a reason in the commit message, never by skipping tests.
- **Coverage**: every file and package passes the 100% gate (`make cover-check`). Exclusions go in
`.testcoverage.yml` with a reason in the commit message, never in a `// coverage-ignore` comment
and never by skipping tests.

### 3. Variable naming

Expand Down Expand Up @@ -214,8 +215,8 @@ helper adds behavior: validation, defaults, an error return, type translation.
### 10. No logging or printing in library code

Library packages never log and never print (`fmt.Print*`, `println`, `log.*`, `slog.*`). They return
errors and diagnostics; the caller decides what to show. Only `pkg/cli`, to the writers it is
given, and `scripts/` print. forbidigo enforces the print half.
errors and diagnostics; the caller decides what to show. Only `pkg/cli` prints, to the writers it
is given. forbidigo enforces the print half.

### 11. Package naming and location

Expand Down
3 changes: 0 additions & 3 deletions .covignore

This file was deleted.

2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ linters:
- examples
- testdata
rules:
- path: ^(cmd|scripts)/
- path: ^cmd/
linters:
- forbidigo
- path: _test\.go
Expand Down
8 changes: 8 additions & 0 deletions .testcoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
profile: coverage.out
# The tool rounds to 0.1%, so a package of 2,000 statements passes with one missed; files are smaller.
threshold:
file: 100
package: 100
exclude:
paths:
- ^cmd/mockzilla-codegen/main\.go$
3 changes: 1 addition & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Module `github.com/mockzilla/mockzilla-codegen`. Built on github.com/pb33f/libop
- `make test-integration-ci` runs what the Integration workflow runs, started by hand for now:
`.github/ci-specs.txt` on every variant with chi, the specs `.github/ci-router-specs.txt` lists
on every framework too. `BATCH=i/n` runs one of n batches, as the workflow's four jobs do.
- Coverage gate exclusions live in `.covignore`.
- The coverage gate is go-test-coverage; its threshold and exclusions live in `.testcoverage.yml`.

## Rules

Expand Down Expand Up @@ -56,4 +56,3 @@ Public packages live under `pkg/`, private ones under `internal/`. No Go files i
| `internal/...` | provider, spec IR, transforms, naming, Go model, rendering, layout |
| `examples/` | separate module: golden examples and tests of generated code |
| `test/` | parse sweep, integration test, benchmarks (build tags) |
| `scripts/covercheck` | per-package coverage gate |
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ specs and takes a while; run one spec, or `make test-integration-ci` for the set
- Output is deterministic: the same spec and config give the same bytes on every run.
- Templates hold no logic beyond `range` and `if` on precomputed fields.
- Golden files change only through `UPDATE=1` runs, never by hand.
- Every line of new code is covered by a test. Exceptions go in `.covignore`.
- Every line of new code is covered by a test. Exceptions go in `.testcoverage.yml`.

## Adding a router

Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ PKG ?= ./...
RUN ?=
CI_SPECS = $(shell grep -v '^\#' .github/ci-specs.txt)
CI_ROUTER_SPECS = $(shell grep -v '^\#' .github/ci-router-specs.txt)
MIN_COVERAGE ?= 100
# go-test-coverage must not need a newer Go than the go directive in go.mod; bump the two together.
COVERAGE_VERSION ?= v2.19.0
# golangci-lint must be built with a Go at least as new as the go directive in go.mod; bump the two
# together.
GOLANGCI_VERSION ?= v2.14.0
Expand Down Expand Up @@ -34,8 +35,8 @@ cover: ## Write coverage.out and coverage.html
go tool cover -html=coverage.out -o coverage.html

.PHONY: cover-check
cover-check: cover ## Fail when a package is below MIN_COVERAGE (default 100)
go run ./scripts/covercheck -profile coverage.out -min $(MIN_COVERAGE) -ignore .covignore
cover-check: cover ## Fail when a file or package is below 100% coverage; exclusions in .testcoverage.yml
go run github.com/vladopajic/go-test-coverage/v2@$(COVERAGE_VERSION) --config=.testcoverage.yml

.PHONY: lint-tools
lint-tools: ## Install golangci-lint GOLANGCI_VERSION into bin/ unless that version is there
Expand Down
16 changes: 0 additions & 16 deletions scripts/covercheck/errors.go

This file was deleted.

61 changes: 0 additions & 61 deletions scripts/covercheck/ignore.go

This file was deleted.

107 changes: 0 additions & 107 deletions scripts/covercheck/ignore_test.go

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/covercheck/main.go

This file was deleted.

29 changes: 0 additions & 29 deletions scripts/covercheck/module.go

This file was deleted.

68 changes: 0 additions & 68 deletions scripts/covercheck/module_test.go

This file was deleted.

Loading
Loading