Skip to main content

Collecting files

A tool collects the files it reads from the governed repo and from the folders it was given. It MUST collect only files tracked by version control, and MUST NOT find them by walking a file system (except in a given folder that is in no working copy, see External folders), so a Lore folder in an installed dependency, a build output or an ignored scratch folder cannot add rules to a review.

  • The governed repo. A tool reads the governed repo as the change leaves it: the files tracked in the change's new version. It collects every Lore file (see Files and folders) and reads every .loreconfig. A Lore file the change deletes is not collected, and one it adds is. (So a change can delete a rule, or switch it off with disable, for its own review: the rule's absence is part of the change a reviewer sees.)

    Rules revision. A tool MAY let its caller name a revision of the governed repo to read Lore files, .loreconfig files and src targets from, instead of the revision the change leaves. The change itself, its files and added and removed lines, is unaffected. Without one, a tool reads as above. This exists because a change judged by its own rules can delete or loosen the rule in its way.

  • A given folder. A tool reads the files tracked in the working copy that holds it, or, for a loose folder, the files under it that External folders counts. It reads every .loreconfig of that repository in the given folder, below it or above it, and collects the Lore files of each external folder found in it: those at or below each marked directory that names the governed repo (see External folders).

  • A .loreconfig is a file named exactly .loreconfig, outside any Lore folder. A file of that name inside a Lore folder is ignored.

  • Files that repo-inside-repo or nested-repo excludes are neither collected nor read (see Where repo may appear).

  • Every .loreconfig that is read is checked, and its errors are reported, whether or not it applies to a collected Lore file. A .loreconfig with a problem marks no directory, so a tool cannot tell which repository it was meant for.

The .loreconfig inside the root Lore folder is ignored, so data_provenance is unknown. In the team repository, team.lore is under no marked directory, and the broken .loreconfig of payments/ is reported although it marks nothing, which leaves payments.lore uncollected:

Example 146 (eligibility)​

.lore/.loreconfig
categories: [data_provenance]
.lore/provenance.lore
<rule id="price-source-recorded" category="data_provenance">
Every stored price records the quote it came from.
</rule>
external:.lore/team.lore
<rule id="team-rules-reviewed" category="documentation">
Every change to the team's rules is reviewed by two people.
</rule>
external:shop/.loreconfig
repo: github.com/acme/shop
external:shop/.lore/checkout.lore
<rule id="price-from-quote" category="functional_correctness">
A displayed price must come from the quote that produced it.
</rule>
external:payments/.loreconfig
repo: github.com/acme/payments
categories: [Payments]
external:payments/.lore/payments.lore
<rule id="refunds-logged" category="observability">
Every refund is logged with the order it refunds.
</rule>
Change
M apps/web/src/checkout/Price.tsx
Expected output
{
"eligible": ["price-from-quote"],
"hits": [],
"excluded": [
{ "name": "unknown-category", "file": ".lore/provenance.lore", "entry": "price-source-recorded", "line": 1 },
{ "name": "invalid-loreconfig", "file": "external:payments/.loreconfig", "entry": null, "line": 2 }
],
"warnings": []
}