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 | jq

Options

  • --diagnostics-format <FORMAT>: Output format of diagnostics. The default is pretty.
  • --diagnostics-file <PATH>: File to write diagnostics to. The default is stderr. On Unix, /dev/stdout and /dev/fd/N are also supported.

Formats

FormatDescriptionRequires --diagnostics-file
prettyHuman-readable output
jsonJSON array of diagnostics✅
json-linesJSON Lines, a diagnostic per line✅
githubGitHub Actions workflow commands
gitlabGitLab Code Quality report✅
junitJUnit XML report✅
sarifSARIF 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.