Add unit tests, integration test, CI workflow, and conventions
- gitea/client_test.go: mock HTTP tests for all API methods + error cases - llm/client_test.go: mock tests for completion, errors, timeouts - review/parser_test.go: JSON parsing, markdown fences, validation - review/formatter_test.go: markdown output, empty/multiple findings - review/prompt_test.go: system/user prompt construction - integration_test.go: full end-to-end flow (build tag: integration) - .gitea/workflows/ci.yml: test + vet + build on push, dual LLM review on PRs - CONVENTIONS.md: coding standards for self-review dogfooding - README.md: usage docs, env vars, architecture
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# Conventions
|
||||
|
||||
## Language & Dependencies
|
||||
|
||||
- Go standard library only — no external dependencies.
|
||||
- Target the latest stable Go release.
|
||||
|
||||
## Error Handling
|
||||
|
||||
- Return errors; never panic.
|
||||
- Wrap errors with context using `fmt.Errorf("context: %w", err)`.
|
||||
- Check all error returns.
|
||||
|
||||
## Testing
|
||||
|
||||
- Test every exported function.
|
||||
- Use `net/http/httptest` for HTTP mocking.
|
||||
- Table-driven tests where multiple inputs share the same assertion logic.
|
||||
- Integration tests use build tags (`//go:build integration`).
|
||||
|
||||
## Style
|
||||
|
||||
- Keep functions short and focused.
|
||||
- Prefer early returns over deep nesting.
|
||||
- Meaningful variable names — no single-letter names outside loop indices.
|
||||
- Comments explain *why*, not *what*.
|
||||
|
||||
## Process
|
||||
|
||||
- `go test ./...` must pass before commit.
|
||||
- `go vet ./...` must pass before commit.
|
||||
- Keep commits atomic and well-described.
|
||||
Reference in New Issue
Block a user