Skip to main content

Error reach

An error reaches as far as it must and no further, and is never silent.

  • A file-level error excludes its Lore file. None of the file's entries is in the document model, and none counts towards Ids.
  • An entry-level error excludes only its entry. The other entries in the file are read as usual.
  • An error in a .loreconfig excludes that .loreconfig, and repo-inside-repo and nested-repo also exclude everything at or below it (see .loreconfig and External folders).
  • A warning excludes nothing.

Wherever a tool reports eligibility, it MUST also report every error in the document model, by name, so that no excluded file, entry or .loreconfig goes unmentioned: for example, "38 rules applied, 2 skipped: unknown-category".

These errors are always file-level:

  • unreadable-structure, top-level-text, unknown-element, duplicate-file-block and file-block-after-entry, which concern the file's structure (see Parsing);
  • invalid-defaults (see Defaults).

These are always entry-level:

  • missing-id, invalid-id, disabled-has-value and src-escapes-root, on an entry's opening tag (see Attributes and Context);
  • duplicate-attribute, on an entry's opening tag or a child's (a file block takes no attributes, so its first one is unknown-attribute);
  • unknown-child, duplicate-child, invalid-meta, invalid-when, empty-when, unknown-condition, invalid-source, regex-not-one-line and regex-outside-dialect, in an entry's children;
  • duplicate-id, across files.

These are file-level in a file block (<defaults> or the file's <scope>), and entry-level in an entry or one of its children: invalid-attribute-value, unknown-attribute, inconsistent-indentation, invalid-yaml, duplicate-key, yaml-feature-not-allowed, invalid-scope, empty-files, leading-slash, invalid-glob and glob-escapes-base. Likewise, unknown-category is file-level in <defaults> and entry-level on a rule's category attribute.

invalid-loreconfig, repo-inside-repo and nested-repo are errors in a .loreconfig.

The middle rule's condition has an unknown key. Only that rule is excluded, and the rules around it are eligible:

Example 125 (eligibility)​

apps/web/src/checkout/.lore/checkout.lore
<rule id="price-from-quote" category="functional_correctness">
A displayed price must come from the quote that produced it.
</rule>

<rule id="currency-from-settings" category="functional_correctness">
<when>
addedContain: ["'USD'"]
</when>
Display text never hard-codes a currency code.
</rule>

<rule id="quote-expiry-shown" category="functional_correctness">
A checkout page that shows a quoted price also shows when the quote expires.
</rule>
Change
M apps/web/src/checkout/Price.tsx
+12 const label = 'USD'
Expected output
{
"eligible": ["price-from-quote", "quote-expiry-shown"],
"hits": [],
"excluded": [
{ "name": "unknown-condition", "file": "apps/web/src/checkout/.lore/checkout.lore", "entry": "currency-from-settings", "line": 6 }
],
"warnings": []
}

The file scope of display.lore has an unclosed brace, so no entry in that file is eligible, and the second one's missing category is not reported either. The rule in the other file is eligible:

Example 126 (eligibility)​

apps/web/src/checkout/.lore/display.lore
<scope>
files: ["**/*.{ts,tsx"]
</scope>

<rule id="currency-from-settings" category="functional_correctness">
Display text never hard-codes a currency code.
</rule>

<rule id="dates-from-locale">
Displayed dates are formatted with the shop's locale.
</rule>
apps/web/src/checkout/.lore/pricing.lore
<rule id="price-from-quote" category="functional_correctness">
A displayed price must come from the quote that produced it.
</rule>
Change
M apps/web/src/checkout/Price.tsx
+12 const label = 'USD'
Expected output
{
"eligible": ["price-from-quote"],
"hits": [],
"excluded": [
{ "name": "invalid-glob", "file": "apps/web/src/checkout/.lore/display.lore", "entry": null, "line": 1 }
],
"warnings": []
}