Skip to content

assay gate [--scope project|changed]

The gate: judges the whole project, or the changed files of a change, with assay’s rules, the SDK lints and the compiler, and answers pass or fail.

assay gate [--scope project|changed]
[--base <commit> | --since <mark file> [--changes <file>]]
[--coverage <lcov file>] [--duplication]
[--reporter <name>[:<file>]]… [--full-report <path>]
[--snapshot <file or directory>] [--compare-with <file or directory>]
[--color auto|always|never]

The two scopes are the two judgements:

  • --scope project, the default, judges the whole project against the baseline. It is the judgement of CI: see CI integrations.
  • --scope changed judges the changed files of a change, to which the baseline does not apply, and fails on what the change added to the baseline. The agent plugin runs it at the end of each turn: see The gate and agent setup. A pull request job runs it on the change of a branch: see The pull request job.

Either removes from the baseline file the entries that no longer match.

Option Effect
--scope project The default. Judges the whole project against the baseline: the judgement of CI.
--scope changed Judges the changed files: what differs from the commit checked out, or the change since --base or --since. The agent plugin runs this at turn end.
--base <commit> With --scope changed: the change since this commit. A pull request job passes the merge-base. See The pull request job.
--since <mark file> With --scope changed: the change since the mark that assay mark wrote. See The change since a mark or a commit.
--changes <file> With --since, in a project in no git repository: the list of the files changed since the mark. See assay mark.
--coverage <lcov file> Judge the gate conditions on coverage by this report, which the project’s tests wrote. See Coverage.
--duplication Judge the gate conditions on duplicated code by what duplicated_code finds. On a change, this runs the checks across files whatever the change holds, where duplicated_code is on. See Duplicated code.
--full-report <path> Write the full report there, instead of under .dart_tool/assay/reports/.
--snapshot <file or directory> Record the judgement of the whole project as one line of JSON, once the reports are written. A usage error with --scope changed. See Snapshots and trends.
--compare-with <file or directory> Add to the Markdown summary how the project moved since a point of the snapshots there (below). See Snapshots and trends.
--reporter <name>[:<file>] console (the default), json, sarif, gitlab, github or markdown, to standard output or to a file. Repeatable. See Commands.
--color auto|always|never The form of the console output, as for every command.

Without --coverage or --duplication, no gate condition on that measure is judged.

--compare-with compares with the point of the change’s base (--base) where the snapshots hold one, else with their latest. They are read before the run; on a change, only the measures of the whole project are compared. What they hold never changes the verdict: the snapshots of another package, of a newer version and what cannot be read are passed by, and where none of the package is there, it is a note.

The command takes no argument.

Terminal window
assay gate # the whole project against the baseline
assay gate --scope changed # what differs from the commit checked out
assay gate --scope changed --base=main # the change since a commit
assay gate --scope changed --since .dart_tool/assay/mark.json # the change since a mark
assay gate --coverage coverage/lcov.info --duplication # with the gate conditions
assay gate --reporter console --reporter github --reporter sarif:build/assay.sarif
assay gate --snapshot assay-snapshots/ # record the run as a snapshot

The gate prints the report of every command that judges: see The console report for its boxes. Below the report stand the notes of the run and the path of the full report. The project judgement of a project with four known violations:

╭─ assay gate ─────────────────────────────────────────────────────────────────╮
│ Preset recommended │
│ Rules 109 │
│ Files 2 in the whole project │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Baseline ─────────────────────────────────────────────────────── 4 entries ─╮
│ Removed in this run none │
│ │
│ Growth record Time Added │
│ ────────────────────────────────────────── │
│ 1 2026-11-23T21:44:29Z 4 │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ ✓ PASS ─────────────────────────────────────────────────────────────────────╮
│ 0 blocking · 0 advisory · 0 of 2 files · 4 in the baseline │
│ ! 4 known violations in the baseline · listed in │
│ .dart_tool/assay/reports/gate-project.txt │
│ Files that no change touched are judged only here, in the project judgement: │
│ the gate on a change judges the changed files. │
╰──────────────────────────────────────────────────────────────────────────────╯
Full report: .dart_tool/assay/reports/gate-project.txt
  • The full report is the same report in the plain form, 100 columns wide, with every violation listed and each one the baseline knows marked. It is written under .dart_tool/assay/reports/, as gate-project.txt or gate-changed.txt, unless --full-report says where.
  • The reporters for CI, GitHub annotations, SARIF, GitLab code quality and the summary in Markdown, are on CI integrations.
  • The JSON result, with the fields a caller such as a CI script reads, is on assay mark.
Code When
0 The gate passes.
1 The gate fails. What fails each scope is on The two judgements and under What fails the gate.
2 A configuration error: nothing is judged, and the result still says that the gate failed, with configuration_error in failedBecause. Or a usage error, which writes no result: an argument; --since and --base together, or either without --scope changed; --changes without --since; --snapshot with --scope changed; --scope changed with neither --since nor --base in a project that is in no git repository; a --coverage report that cannot be read, is not lcov or names no file of the project; --compare-with given no path; a reporter the command does not take, or two reporters given the same file.
3 assay could not run: the standard analysis command could not be started or did not end within its time limit, or git does not say what changed. Or a report file, the snapshot or the baseline file could not be written: the other reports are still written, and standard error names the path and shows the verdict.

The cases of a change since a mark or a commit are on assay mark, and those of a list of changes under Outside git.