Skip to content

Report and formatters ​

Builds the run's report, the counts included, and prints it in the format --format selects. Every format renders the same report, with findings in the same order.

The report holds the run's metadata (linter, plugin and SUSHI versions, compat, full or targeted run), every finding left after suppressions, and a summary: files read and skipped, Questionnaires, expressions analysed and unchecked, findings by severity, suppressions and the FSH directories. An expression is unchecked when a rule that applies there could not finish its check, for example after a defineVariable with a computed name.

FormatForWhat it writes
textPeople at a terminalOne block per finding, then the summary. Info findings are hidden unless --show-info is given.
jsonScripts and agentsThe report itself, as the JSON report format and its schema define it
githubGitHub ActionsOne annotation per finding, every finding in a collapsed log group, and a Markdown table in the job summary
sarifGitHub code scanning and other SARIF viewersOne SARIF 2.1.0 log, with the rules that ran and one result per finding

The first line of each finding in text has a stable shape, so editors and scripts can read it:

text
input/fsh/Example.fsh:42:18: error sdc/undefined-variable "Patient name" (patient-name) uses %patientNmae, which is not defined.

The lines below it (location:, note:, related: and help:) are the same in text, github and sarif. A finding with no FSH location names the compiled file, without a line or column, and its location: line gives the resource and JSON Pointer instead.

Output formats in the CLI reference is the full contract for each format.

Schema ​

Code ​

In packages/core/src/report/:

  • types.ts: the report's types, public API, matching the report schema.
  • summary.ts and expression-coverage.ts: buildSummary computes the counts, and summarizeExpressionCoverage the analysed and unchecked expressions.
  • sort.ts: compareFindings, the one order every format uses: by file, line and column, then rule.
  • locations.ts: where a finding is, and its location:, note:, related: and help: lines, shared by text, GitHub and SARIF.
  • The formats: text.ts, json.ts, github.ts with the job summary, and sarif.ts. github.ts and sarif.ts also write a failed run.
  • colour.ts: colours the severity in text, when the CLI allows colour.