CI integrations
In CI, assay gate judges the whole project with both engines against the baseline. A new blocking violation or a file that does not compile fails it; a known violation does not. It also prints the baseline’s size, the entries it removed and the growth records. The console form is on The two judgements.
The baseline that the project judgement reads is on Baseline. A pipeline to copy is on GitHub Actions, GitLab CI and Other CI systems.
Output formats
Section titled “Output formats”assay gate --reporter console --reporter github --reporter sarif:build/assay.sarifassay gate --reporter console --reporter gitlab:build/gl-code-quality.json-
GitHub annotations (
github): one workflow command per violation, on standard output beside the console report.errorfor a blocking violation or a compile error;noticefor an advisory one and for every violation the baseline knows, whatever its tier, soerroris left to what fails:::error file=lib/greeting.dart,line=2,col=35,title=avoid_non_null_assertion::The '!' operator throws at run time when the value is null.%0AHandle the null case: test for null, or use '??', '?.' or a null-check pattern.::notice file=lib/prices.dart,line=14,col=58,title=avoid_non_null_assertion (in the baseline)::The '!' operator throws at run time when the value is null.%0A…Blocking ones come first, because GitHub caps the annotations it shows.
-
SARIF 2.1.0 (
sarif): for GitHub code scanning and other viewers, checked by hand against the published schema. Blocking violations and compile errors areerror, advisory onesnote. Each result carries its fingerprint (partialFingerprints) andbaselineState(unchangedif known, elsenew); each rule its tier and its page ashelpUri. A duplicated region lists up to 10 other copies asrelatedLocations. A rule of security adds its security class andsecurity-severity, so code scanning lists its violations as security alerts, ranked by severity (9.0 and above critical, 7.0 high, 4.0 medium, below that low); the level still follows the tier. -
GitLab code quality (
gitlab): a JSON report for a merge request’s code quality widget.blockerfor a compile error,majorfor a blocking violation,minorfor an advisory one. -
A summary in Markdown (
markdown): for the summary of a step (markdown:"$GITHUB_STEP_SUMMARY") or a comment on a pull request. See below.
Two failures have no place in the code. The GitHub reporter writes each as an error with no file, shown on the run before the violations and counted on the verdict line:
- a failed gate condition, titled
gate condition(* 1 failed gate condition); - entries a change added to the baseline, titled
baseline growth(“2 entries were added to the baseline: remove them, and fix the violations they stand for.”,* 2 entries added to the baseline).
SARIF and GitLab carry neither: their entries are findings at a place in the code. The console report, the full report and the Markdown summary list every condition.
A report file is always written in the plain form, whatever --color says, and replaced whole.
The summary in Markdown
Section titled “The summary in Markdown”assay gate --reporter console --reporter markdown:build/assay-summary.mdIt holds, in this order:
- the command and the verdict; the scope, preset, rules and files;
- why it fails, by the names of the result schema (
blocking_violation,gate_condition, …), and theNext:step; - the violations by tier: new apart from known, and on a change the changed files apart from the whole-project results;
- the configuration and compile errors;
- for the gate: the gate conditions (
at leasta floor,at mosta ceiling), the line coverage and duplicated code, the comparison with--compare-with, the entries added to the baseline, new suppressions, new coverage-ignore comments, configuration changes and notes; - the first 50 violations, blocking first, then
+N more; full report: <path>. Other lists show ten and count the rest.
## assay gate: FAIL
Scope: changed files - preset: recommended - 32 rules - 2 changed files
Fails because of:
- blocking violations (`blocking_violation`)- gate conditions that are not met (`gate_condition`)
Next: fix the blocking violations and raise the coverage of the new lines to 80% (3 more lines covered), then run `assay gate --scope changed --base 3f1c2ab --coverage coverage/lcov.info` again.
| Violations | Blocking | Advisory ||:--|--:|--:|| In the changed files | 1 | 0 || In the whole project | 0 | 0 |
### Gate conditions
| Condition | Measured | Threshold | Status ||:--|--:|--:|:--|| coverage on the new lines | 62.5% | at least 80% | failed || coverage overall | 72.0% | at least 70% | passed |
Line coverage: 72 of 100 coverable lines ran (72.0%), 10 of 16 new ones (62.5%), by the report coverage/lcov.info.
### Violations (1)
| Place | Tier | Rule | Message ||:--|:--|:--|:--|| lib/greeting.dart:2 | blocking | avoid_non_null_assertion | The '!' operator throws at run time when the value is null. |
Full report: `.dart_tool/assay/reports/gate-changed.txt`- Size: 60,000 characters at most, under GitHub’s 65,536 for a comment. Violations that do not fit are counted in
+N more, a project text over 500 characters is cut with an ellipsis, and a summary still too long is cut at a line end and says so. - Escaping: every message, path and rule is escaped so it cannot break a table or open markup. A zero-width space breaks an
@before a name, a#before a number,GH-12and the address of an issue, pull request or discussion, so a comment mentions nobody and links no issue. Control characters show as\x1B,\nand the like. - Standard output takes one document at most, so write the summary to a file beside
consoleorgithub.
The pull request job
Section titled “The pull request job”The project judgement is the judgement of CI. A pull request job can also judge the change, with the gate on a change:
- every violation in the branch’s changed files, known to the baseline or not (as at turn end);
- the whole-project results through the baseline, and the project-file checks whatever the branch changed;
- the gate conditions on coverage and duplicated code, including
min_on_new_linesandmax_on_new_lines, which only a change has.
Pass the merge-base, where the branch left its target, as --base: --base "$(git merge-base HEAD origin/$GITHUB_BASE_REF)" on GitHub Actions. --base origin/main would count every commit main got since as part of the pull request. The job pull-request of the GitHub Actions pipeline and the job assay-merge-request of the GitLab pipeline are such jobs.
- Fetch both branches:
fetch-depth: 0on GitHub Actions,GIT_DEPTH: 0on GitLab. Otherwisegit merge-basefinds nothing and the gate ends with a usage error (exit code 2), not a verdict. - On GitLab, the merge-base is
--base "$CI_MERGE_REQUEST_DIFF_BASE_SHA". - Run the tests first, after the checkout and in the same job, so the report is newer than every file it counts; a condition on an older report is not judged.
- Conditions on coverage need
--coverage, those on duplication--duplication; without them they are listed as not judged and change nothing. A failed condition fails the job with exit code 1. With--duplicationand a condition on it, the cross-file checks run on any change, even a README alone. markdown:"$GITHUB_STEP_SUMMARY"replaces what the same step wrote there, so that step writes nothing else to it.--compare-with assay-snapshots/adds a blockSince main (3f1c2ab, 2026-11-20): the baseline, coverage and duplication at the merge-base’s snapshot and now, and the events between. The job restores the default branch’s snapshots before the gate. With none there yet, the summary says so and nothing fails. See Snapshots and trends.
Keep the project judgement as a job of its own: it sees the files the pull request did not touch.
Pipelines
Section titled “Pipelines”Each pipeline:
- runs
pub get, since the program reads the preset from the project’s ownassay_lints(without it, a configuration error); - installs the program pinned to the version of
assay_lintsinpubspec.lock, and puts the pub cache’sbinon the PATH (no pubspec getsassayorassay_cli); - runs the tests with coverage, then
assay gate; - on the default branch, records the run with
--snapshot,assay metricsandassay trend, whatever the verdict, restoring the earlier snapshots before and keeping them after for the pull request job to compare with (other stores). Add/assay-snapshots/to.gitignore.
The pipelines:
- GitHub Actions: a workflow with the jobs
gateandpull-request, with the snapshots in the cache. - GitLab CI: the jobs
assayandassay-merge-request, with the snapshots in the cache and an artifact. - Other CI systems: a shell script for any other CI, with the snapshots in a shared directory.