Skip to content

feat(cli): implement json, json-pretty, and summary reporters#695

Merged
psteinroe merged 2 commits intomainfrom
fix/reporter
Feb 27, 2026
Merged

feat(cli): implement json, json-pretty, and summary reporters#695
psteinroe merged 2 commits intomainfrom
fix/reporter

Conversation

@psteinroe
Copy link
Collaborator

Summary

  • Adds Json, JsonPretty, and Summary variants to CliReporter enum and wires them through ReportMode dispatch
  • Implements json.rs reporter: outputs diagnostics as JSON with human-friendly line/column locations
  • Implements summary.rs reporter: outputs only aggregate counts (errors, warnings, file stats, duration)
  • Adds 3 snapshot tests and extends duration normalization for deterministic JSON/summary snapshots

Closes #694

Test plan

  • cargo test -p pgls_cli --test assert_check — all 9 tests pass
  • cargo clippy -p pgls_cli --all-targets --all-features — no new warnings
  • Snapshot output verified for --reporter json, --reporter json-pretty, --reporter summary

The CLI advertised these as valid --reporter values but they were not
implemented, causing an error when used. Adds the three missing reporter
variants with snapshot tests.

JSON output shape aligned with Biome: summary object with numeric nanos
duration, per-diagnostic message/category/location, command field, and
zero-span fallback when source location is unavailable.

Summary reporter reuses ConsoleTraversalSummary from terminal reporter
and groups diagnostics by file with per-file error/warning counts.

Closes #694

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Copy link
Collaborator

@juleswritescode juleswritescode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet!

@psteinroe psteinroe merged commit 1f980cc into main Feb 27, 2026
9 checks passed
@psteinroe psteinroe deleted the fix/reporter branch February 27, 2026 08:25
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.

Invalid values for global option --reporter

2 participants