Diagnostics Output
tombi format and tombi lint can write diagnostics in machine-readable formats for CI and other tools.
# JUnit report of unformatted files
tombi format --check --diagnostics-format junit --diagnostics-file junit.xml
# GitLab Code Quality report
tombi lint --diagnostics-format gitlab --diagnostics-file gl-code-quality-report.json
# GitHub Actions annotations
tombi lint --diagnostics-format github
# JSON to stdout
tombi lint --quiet --diagnostics-format json --diagnostics-file /dev/stdout | jqOptions
--diagnostics-format <FORMAT>: Output format of diagnostics. The default ispretty.--diagnostics-file <PATH>: File to write diagnostics to. The default is stderr. On Unix,/dev/stdoutand/dev/fd/Nare also supported.
Formats
| Format | Description | Requires --diagnostics-file |
|---|---|---|
pretty | Human-readable output | |
json | JSON array of diagnostics | ✅ |
json-lines | JSON Lines, a diagnostic per line | ✅ |
github | GitHub Actions workflow commands | |
gitlab | GitLab Code Quality report | ✅ |
junit | JUnit XML report | ✅ |
sarif | SARIF 2.1.0 report | ✅ |
Lines and columns are 1-based.
Columns count grapheme clusters, like the output of pretty, except for sarif, which counts UTF-16 code units.
Problems with a whole file are reported with the following codes:
not-formatted: the file is not formatted (tombi format --check).io-error: the file could not be found, read, or written.
When reading from stdin, formats other than pretty require --stdin-filename.