Skip to content

Adopting assay in an existing project

A project that adopts assay usually has violations already. You do not fix them first. You record them in the baseline, hold every change to the gate from that day on, and work the old ones off while the baseline shrinks. Each step below links to the page that has the detail.

Follow Getting started: add assay_lints, include a preset, and install the command-line program. assay init writes the include: line for you.

Each of the three presets holds all of the one before it, and more: core holds 11 blocking rules, recommended 109 rules and strict all 147. Begin with the one whose violations you are ready to record; step 7 moves to the next.

Terminal window
assay check --no-baseline

assay check lists every violation of assay’s rules, by file, with each rule’s message and how to fix it. For the whole judgement of CI, with the SDK lints and the compiler’s warnings as well, run assay gate: its full report lists every violation.

Before you record anything:

  • Mend what does not compile. The baseline holds no compile error, and a file that does not compile fails the gate.
  • Apply the fixes. assay fix --dry-run prints the edits of every available fix, and assay fix writes them.
  • Switch off what the project does not want, or change a limit, under the assay: key (Configuration). Leave generated and legacy paths out with exclude.
Terminal window
assay baseline update --add

This creates assay_baseline.json at the project root with every current violation of both tiers: those of assay’s rules, the SDK lints, the cross-file checks and the project-file checks. See Creating the baseline.

Commit assay_baseline.json. Its entries are sorted, so a later change to it is a small diff. From now on assay baseline status shows its size, its growth records and how many entries no longer match.

Run assay gate in CI: it judges the whole project against the baseline, so a new blocking violation or a file that does not compile fails it, and a known violation does not. CI integrations has the output formats, and a pipeline for GitHub Actions, GitLab CI and other CI systems.

To hold an AI coding agent to the gate at the end of each turn as well, install the agent plugin (The gate and agent setup). At turn end the baseline does not apply to the files the session changed: touching a file means cleaning it (The two judgements).

The baseline shrinks by itself. When check or gate judges a file and no longer finds a violation the baseline holds, it removes the entry from the file (How the baseline shrinks). Commit the smaller assay_baseline.json with the fix.

It grows only on purpose, with assay baseline update --add, and each such run leaves a growth record (Growing the baseline). To watch the number of entries fall over time, record snapshots in CI and read them with assay trend (Snapshots and trends).

When the baseline of the preset is small enough, move up: change the one word in the include: line, or run assay init --preset <preset>. If the project has violations under the next preset, record them with assay baseline update --add, and the gate holds new code to the new preset (Moving from one preset to the next).