Skip to content

Commit d2f988f

Browse files
authored
Test Coverage, CLAUDE.md, and README Footer (#39)
* Update CLAUDE.md with expanded Makefile targets and updated commands Enhance documentation to include detailed descriptions for existing and new Makefile targets, updated build and testing commands, and clarified directory structure for integration and E2E tests. * Update README with author and sponsorship details Add attribution to Craig Johnston and sponsorship acknowledgment for Deasil Works, Inc. at the end of the README. * Add comprehensive test suite for CLI commands and dry-run functionality Extend test coverage with dry-run tests for `RemoveIPs`, `RemoveCIDRs`, and `RemoveByComment`. Add validation tests for CLI commands, including `add`, `remove`, `list`, and `show` commands, and run function tests to ensure correct command behavior.
1 parent bedfe2c commit d2f988f

File tree

3 files changed

+592
-17
lines changed

3 files changed

+592
-17
lines changed

CLAUDE.md

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ txeh is a Go library and CLI utility for managing /etc/hosts file entries. It pr
1818

1919
```bash
2020
# Full verification (run before every commit)
21-
make verify
21+
make verify # fmt, lint, test-unit, security, go mod verify
2222

23-
# Run all tests including integration
24-
make verify-full
23+
# Extended verification
24+
make verify-full # fmt, lint, test, security, go mod verify
2525

2626
# Format, lint, test individually
27-
make fmt
28-
make lint
29-
make test-unit
30-
make coverage
31-
make security
27+
make fmt # gofmt + goimports
28+
make lint # golangci-lint
29+
make test-unit # go test -race ./...
30+
make coverage # Coverage report (HTML + summary)
31+
make security # gosec + govulncheck
3232
```
3333

3434
## Architecture
@@ -141,22 +141,34 @@ entries := hosts.ListHostsByComment("myapp")
141141

142142
```bash
143143
# Development
144-
make build # Build CLI binary
145-
make test-unit # Run unit tests
146-
make lint # Run linter
147-
make fmt # Format code
144+
make build # Build CLI binary to txeh/dist/
145+
make test-unit # Run unit tests with race detection
146+
make lint # Run golangci-lint
147+
make lint-fix # Run golangci-lint with auto-fix
148+
make fmt # Format code (gofmt + goimports)
148149

149150
# Before committing
150-
make verify # Format, lint, test, security scan
151+
make verify # fmt, lint, test-unit, security, go mod verify
151152

152-
# Full CI verification
153-
make verify-full # Includes integration tests
153+
# Extended verification
154+
make verify-full # fmt, lint, test, security, go mod verify
155+
156+
# Testing
157+
make test-integration # Integration tests (tagged)
158+
make test-e2e # E2E tests (tagged, requires Docker)
159+
make coverage # Generate coverage report (HTML + summary)
160+
161+
# Code quality
162+
make security # gosec + govulncheck
163+
make dead-code # Check for unreachable code (deadcode)
164+
make check # go vet + staticcheck + golangci-lint
165+
make mutate # Mutation testing (gremlins, threshold 60%)
154166

155167
# Debugging
156168
go test -v -run TestSpecific ./... # Run specific test
157169

158-
# Build release
159-
goreleaser --skip-publish --clean --skip-validate
170+
# Build release (goreleaser v2)
171+
goreleaser release --snapshot --clean
160172
```
161173

162174
## File Naming Conventions
@@ -165,6 +177,9 @@ goreleaser --skip-publish --clean --skip-validate
165177
|---------|---------|
166178
| `*_test.go` | Test files (same package) |
167179
| `txeh/cmd/*.go` | CLI command implementations |
180+
| `test/integration/` | Integration tests (`-tags=integration`) |
181+
| `test/e2e/` | End-to-end tests (`-tags=e2e`) |
182+
| `GNUmakefile` | Build automation (use `make`) |
168183

169184
## Git Commit Guidelines
170185

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,8 @@ GITHUB_TOKEN=$GITHUB_TOKEN goreleaser --clean
300300
301301
Apache License 2.0
302302
303+
---
304+
305+
Open source by [Craig Johnston](https://twitter.com/cjimti), sponsored by [Deasil Works, Inc.](https://deasil.works/)
306+
303307
[/etc/hosts]:https://en.wikipedia.org/wiki/Hosts_(file)

0 commit comments

Comments
 (0)