samtes opened a new pull request, #13147:
URL: https://github.com/apache/trafficserver/pull/13147

     ## Summary
   
     - Extracts error/warning rendering from `ErrorCollector` into a pluggable 
`ErrorFormatter` hierarchy (`src/formatters.py`), so the collector no longer 
hard-codes plain-text
     output.
     - Adds a `--error-format {plain,json,markdown}` CLI flag for `hrw4u` / 
`u4wrh`; JSON emits one compact object per input (NDJSON-friendly for bulk 
mode, schema-versioned) and
     Markdown emits a report suitable for PR comments and chat. Plain remains 
the default and is byte-identical to the previous output.
     - Routes all non-syntax failures (file I/O, argument mistakes, visitor 
errors) through new `emit_fatal_message` / `emit_fatal_error` helpers so 
structured formats see every
     diagnostic, not just parser errors.
     - Omits the `Found 1 error:` preamble when there is a single error in 
plain output, matching what users actually expect for one-off runs.
     - Fails fast in the Makefile with a helpful install hint when the ANTLR 
generator is not on `PATH`, instead of producing confusing downstream errors.
   
     ## Test plan
   
     - [ ] `cd tools/hrw4u && make test` — unit tests in `tests/test_cli.py` 
and `tests/test_errors.py` pass, including the new formatter and CLI flag 
coverage.
     - [ ] Run `hrw4u --error-format plain <bad.hrw4u>` on a single-error input 
and confirm the `Found 1 error:` preamble is gone and output is otherwise 
unchanged from `master`.
     - [ ] Run `hrw4u --error-format json <bad.hrw4u>` and verify the output 
parses as JSON, contains `schema_version: 1`, and reports 0-based columns.
     - [ ] Run `hrw4u --error-format markdown <bad.hrw4u>` and confirm the 
rendered report is readable when pasted into a GitHub PR comment.
     - [ ] Bulk mode: run with multiple `input:output` pairs under 
`--error-format json` and verify one JSON object per input (NDJSON).
     - [ ] Temporarily rename/hide the `antlr` binary and run `make gen` — 
confirm the build stops with the "not found on PATH" message instead of a 
cryptic failure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to