# Run `kix check -o sarif` in CI

Use `kix check -o sarif` when your CI system accepts SARIF 2.1.0 findings. The
command still runs cluster evaluation and the normal checks, but writes SARIF
instead of the terminal summary.

This guide assumes the job has Kix and the cluster's Nix dependencies
available.

## Write the SARIF file

Redirect stdout to a file:

<Command
  commands={["kix check 19-scorecards -o sarif > kix-results.sarif"]}
  cwd="kix-examples/"
/>

Upload `kix-results.sarif` with your CI provider's SARIF or code-scanning
integration. Preserve the command's exit status so error-level checks still
fail the job, even if the upload step runs after a failure.

The captured example below contains warning and note findings from the
checked-in scorecard scenario:

<Command expandable {...sarif} />

Each result includes a rule ID, SARIF level, and message. Kix emits a valid
empty SARIF run when the cluster has no scorecard findings, so the upload step
can use the same path for clean and failing builds.

Error-severity findings become failed assertions. Kix collects all failed
assertions into a single evaluation error before a scorecard report is
produced, and writes that evaluation error as one error-level SARIF result
containing all failed assertion messages (attributed to the first
`[scorecard:<rule>]` tag in the error message when present).

Keep this behavior in mind before promoting a rule to `error` in
[Override scorecard severity](/docs/how-to/policy-ci-and-compliance/override-scorecard-severity/).
An error rule stops evaluation and collapses the failures into a single SARIF
result rather than emitting separate per-finding results from a completed
scorecard report.

In CI, configure the upload step to run even when `kix check` exits non-zero,
then propagate the original exit status so the job still fails.

:::note[Reference]
See [`kix check`](/docs/reference/cli/check/) for check phases and exit
behavior, and [Finding schema](/docs/reference/scorecard-and-rules/#finding-schema) for
the underlying Kix finding fields.
:::