Adopt sources file by file
This guide adds <source> blocks to an existing rule set one Lore file at a time, without failing the build along the way. Requires lore 0.6.0 or later for every tool that reads the rules.
-
Upgrade every tool first. An older tool leaves out a rule with a
<source>, and ignores a.loreconfigwith anauditkey. Upgrade thelorecommand in CI and on each machine, and any editor extension, before the first rule file uses either. -
Add sources to one Lore file. Give each rule the document it came from, with a
headingorphrasewhere the document has one:<rule id="money-in-minor-units" category="functional_correctness"><source>file: docs/checkout-review.mdheading: Money is integer minor units</source>Amounts are integers in minor units (cents).</rule> -
See what needs review. Every new source starts
never-reviewed, a warning, solore auditstill exits 0:.lore/checkout.lorewarn never-reviewed money-in-minor-units docs/checkout-review.md#Money is integer minor units -
Review the file. Read each rule against the text it cites. When they agree, record the whole file at once:
npx @mattstack/lore review --file .lore/checkout.loreA source that does not resolve, such as a heading that was renamed, is refused and printed on stderr. Fix the
<source>, then run the command again. -
Commit the lock file.
lore auditreadslore-reviews.lockonly once git tracks it:git add lore-reviews.lock -
Repeat for the next file. Once every file is done, consider raising
never-reviewedto an error in your root.loreconfig, so new rules arrive with their review:audit:levels:never-reviewed: error
Next steps
- Sources and reviews: the review cycle after adoption.
lore review: naming rules by id,--dateand--prune.- Run Lore in CI: run
lore auditon every pull request.