Skip to content

refactor: scanner as library + CLI, remove issue posting#31

Merged
packet-mover merged 1 commit intomainfrom
refactor/remove-issue-posting
Apr 14, 2026
Merged

refactor: scanner as library + CLI, remove issue posting#31
packet-mover merged 1 commit intomainfrom
refactor/remove-issue-posting

Conversation

@packet-mover
Copy link
Copy Markdown
Contributor

Summary

Scanner becomes a pure library (scan + format). Issue posting moves out - callers (like Codatus App) handle it via their own GitHub client.

  • Removed `Run()`, `Config.ReportRepo`, and `CreateIssue` from the `GitHubClient` interface
  • Added functional options to `Scan()`: `WithBaseURL(url)` lets callers point the scanner at a custom API (useful for WireMock in integration tests or GitHub Enterprise)
  • Refactored `Scan(ctx, cfg Config, opts ...Option)` - constructs a client from `cfg.Token` and options, delegates to internal `scanWithClient`
  • CLI now reads `CODATUS_ORG` + `CODATUS_TOKEN` only, prints the Markdown report to stdout, logs scan summary to stderr. Pipeable: `codatus > report.md`

Test plan

  • `go test ./...` - all tests pass
  • `go vet ./...` clean
  • Scanner tests updated to call internal `scanWithClient` (preserves mock client usage)
  • Removed `TestCreateIssue_*` tests (no longer relevant)

- Remove Run(), ReportRepo from Config, and CreateIssue from GitHubClient
- Scan() now takes Config + functional options (WithBaseURL for custom API)
- Internal scanWithClient() holds the scan loop, used by Scan and tests
- CLI reads org/token, prints Markdown report to stdout (log to stderr)
- Callers (e.g., Codatus App) handle issue posting via their own GitHub client
@packet-mover packet-mover merged commit ffcbcdd into main Apr 14, 2026
2 checks passed
@packet-mover packet-mover deleted the refactor/remove-issue-posting branch April 14, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant