Document model
A tool that parses Lore files builds a document model: the entries it
read from every collected Lore file, and the errors and warnings it found
in them and in every .loreconfig it read. A tool that computes
eligibility builds an eligibility result. Both are JSON values, and
the conformance examples compare against them (see
Conformance examples). A tool MAY emit either one
in this form. Their shapes are also given as
document-model.schema.json and
eligibility.schema.json.
A document model is an object with three members:
| Member | Value |
|---|---|
entries | Every entry that no error excludes, rules and contexts alike, disabled entries included (see Error reach). |
errors | A diagnostic for each error that Parsing and Error reach say the model lists, in a Lore file or in a .loreconfig. |
warnings | A diagnostic for each missing-category, empty-scope and unknown-disabled-id found outside an excluded file, entry or .loreconfig. The other warnings are found when computing eligibility, and only an eligibility result carries them. |
Each array is in the order that Conformance examples
gives under Order, and every file field follows Paths there.
Paths. A file is a path from the root of the repository that holds
the file. A file of the governed repo has its plain path, except that a
file read from a rules revision has rules: before it. A file of a
given folder's repository has external: before its path, so that it is
never mistaken for a file of the governed repo, and a file of a loose
folder has loose: before its path from that folder (see
External folders). The prefix does not say which
repository the file is in, so a tool given folders of two repositories
can list two different files with the same file. This version of the
format does not tell them apart. Every other path in either output
(globs in scopes, plain src values, each file in sources, and
hits) names a path in the governed repo, apart from a file-relative
src in an external folder (see Context) and a sources
file that has the external: or loose: prefix (see
File paths).
Entry fields
| Field | Value |
|---|---|
kind | "rule" or "context". |
id | The entry's id (see Attributes). |
file | The path of the Lore file that holds the entry. |
category | A rule's category, found as Categories and severity says, or null when it has none. Always null for a context. |
severity | A rule's severity, "blocking" or "advisory", never null. Always null for a context. |
disabled | true when the entry has the disabled attribute, otherwise false. A disable list does not change it. |
scopes | The file's scope, then the entry's own <scope> when it has one, each as an object with files and ignores, defaults filled in and globs resolved (see Scope and globs). A path is in the entry's scope when it is in every item. |
when | The <when> mapping as parsed, with its globs as written, or null when the entry has none (see Conditions). |
checks | Each <check> as an object with lang and body, in the order they appear (see Checks). Always [] for a context. |
meta | The <meta> mapping as parsed, or null when the entry has none (see Children). |
summary | The first paragraph of the prose (see Entries). |
prose | The entry's prose, which for a context is its body (see Entries). |
src | A context's resolved src, or null when it has none (see Context). Always null for a rule. |
sources | Each item of a rule's <source>, in the order written, as an object with file, heading and phrase: file resolved, and heading and phrase as written or null when absent (see Sources). [] for a rule without <source>, and always [] for a context. |
Diagnostics
Every error and warning is reported as a diagnostic:
| Field | Value |
|---|---|
name | The problem's name (see Errors and warnings). |
file | The path of the Lore file or .loreconfig the problem is in. For ast-grep-no-language, the changed file the check skipped. |
entry | The id of the entry the problem is in, or null, as Diagnostic entry in Conformance examples says. For ast-grep-no-language, the rule's id. |
line | The line, counted from 1, as Diagnostic lines in Conformance examples says. |
Eligibility result
An eligibility result is an object with four members (see Eligibility):
| Member | Value |
|---|---|
eligible | The id of every eligible entry, in ascending order. |
hits | Each hit as an object with rule, file, line and text: the rule's id, the changed file's new path (for a hit on a removed line, its old path), the line's number counted from 1, and that line's text (see Running checks); a hit on a removed line also has side set to "old". |
excluded | The document model's errors. |
warnings | The document model's warnings, with missing-src-target, unsupported-check-language and ast-grep-no-language added as Eligibility says. |