Skip to content

Commit d10b56e

Browse files
Address review: table tests, godocs, code style
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 45596c9 commit d10b56e

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,30 @@ assert.Equal(t, "expected", actual)
106106

107107
Interfaces use `moq`: `//go:generate moq -rm -out prompter_mock.go . Prompter`. Run `go generate ./...` after interface changes.
108108

109+
### Table-Driven Tests
110+
111+
Use table-driven tests for functions with multiple input/output scenarios. See `internal/agents/detect_test.go` or `pkg/cmd/issue/list/list_test.go` for examples:
112+
113+
```go
114+
tests := []struct {
115+
name string
116+
// inputs and expected outputs
117+
}{
118+
{name: "descriptive case name", ...},
119+
}
120+
for _, tt := range tests {
121+
t.Run(tt.name, func(t *testing.T) {
122+
// arrange, act, assert
123+
})
124+
}
125+
```
126+
127+
## Code Style
128+
129+
- Add godoc comments to all exported functions, types, and constants
130+
- Avoid unnecessary code comments — only comment when the *why* isn't obvious from the code
131+
- Do not comment just to restate what the code does
132+
109133
## Error Handling
110134

111135
Error types in `pkg/cmdutil/errors.go`:

0 commit comments

Comments
 (0)