Skip to content

Baselines

To adopt the tool on an existing codebase without fixing everything first:

Terminal window
vendor/bin/worker-safety baseline

This writes worker-safety-baseline.json, which you commit. Recorded findings stop failing the build; new ones still do.

Terminal window
vendor/bin/worker-safety scan # baseline applied automatically
vendor/bin/worker-safety scan --no-baseline # report everything again
vendor/bin/worker-safety scan --generate-baseline # same as `baseline`

Baseline entries are fingerprinted from the rule, the file, the symbol and the whole reported construct — not the line number, and with no length limit. The code component is taken from the token stream, so:

  • inserting lines above a baselined finding does not resurrect it, and neither does re-indenting the file or adding a comment inside the construct;
  • changing the code does resurrect it, including a change on a continuation line of a long multi-line statement, and including whitespace inside a string literal or a heredoc, which is content rather than formatting.

A baseline is never written from an incomplete scan: if a file could not be analyzed, baseline refuses rather than recording a gap as accepted.