Skip to content

Baseline Mode

When adding validation to an existing project, you may have many code blocks that already fail. Baseline mode lets you record these known errors so that only new errors cause CI failures.

Run the validator with --save-baseline to create a baseline file from the current state:

Terminal window
md-go-validator --save-baseline baseline.txt .

The baseline file contains signatures in the format file:line:errorcode. Each signature uniquely identifies a known error.

In CI, pass --baseline to filter out known errors:

Terminal window
md-go-validator --baseline baseline.txt .

Only errors that are not in the baseline will cause a non-zero exit code.

  1. Initial adoption: Run --save-baseline to capture existing errors
  2. Commit the baseline: git add baseline.txt
  3. Fix incrementally: As you fix errors, regenerate the baseline
  4. Enforce going forward: CI fails only on new errors

After fixing errors, regenerate:

Terminal window
md-go-validator --save-baseline baseline.txt .
git add baseline.txt
git commit -m "chore: update baseline after fixing doc errors"