OLR · Open Linting Ruleset
An Open Linting Ruleset (OLR) describes a collection of checks that a team wants to apply consistently. It gives each rule an identifier, selects the documents to which it applies, and names the assertion that should be evaluated. Versioning the collection lets projects share it and lets reviewers establish which rules a particular check was meant to apply.
Scope and evaluation
For each rule, the publisher describes how to select the target, which parameters to pass to the assertion, and how to report a violation. This can describe a check on a business convention or a contract field as readily as a code-style check, provided the runner implements that assertion.
The runner locates the documents and executes the check. Validating the ruleset itself establishes that the instructions have the expected structure. To find out which checks ran against a particular target and what they found, consult the result of that run. See the validation report.
Field reference
Read each table within its named object. A required field must be present whenever that object is supplied. Brackets ([]) denote one array entry.
Document
Only the fields listed here are accepted.
| Field | JSON type | Required | Meaning and constraints |
|---|---|---|---|
rulesetId |
string | Yes | Stable catalogue identifier for this collection of checks. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits. |
version |
string | Yes | Revision of the ruleset a runner should apply. Use three numeric parts, optionally followed by a suffix starting with - or +. |
metadata |
object | Yes | Information about the publisher and its namespace. |
rules |
array of objects | Yes | Checks to apply to the selected documents. At least one entry is required. |
description |
string | No | What this collection checks. |
metadata
Additional properties are accepted.
| Field | JSON type | Required | Meaning and constraints |
|---|---|---|---|
namespace |
string | Yes | Namespace that owns the ruleset. Start with okham. and add one or more dot-separated segments beginning with a lowercase letter and continuing with lowercase letters or digits. |
rules[]
Only the fields listed here are accepted.
| Field | JSON type | Required | Meaning and constraints |
|---|---|---|---|
ruleId |
string | Yes | Stable identifier used to connect a finding to its rule. Use at least four dot-separated segments. Each begins with a lowercase letter and may also contain digits, underscores or hyphens. |
severity |
string | Yes | How the runner classifies a violation. Allowed values are error, warn, info. |
scope |
string | Yes | Area of the project or contract covered by the rule. Must be nonempty. |
selector |
object | Yes | Selects the documents to inspect. |
assert |
string | Yes | Name of the assertion implemented by the runner. Must be nonempty. |
params |
object | Yes | Arguments passed to that assertion. |
message |
string | Yes | Explanation recorded when the assertion fails. Must be nonempty. |
suggestedFix |
string | No | Advice for correcting a violation. |
rules[].selector
Additional properties are accepted.
| Field | JSON type | Required | Meaning and constraints |
|---|---|---|---|
documentKind |
string | Yes | Document kind recognised by the runner, for example note. Must be nonempty. |
globs |
array of strings | Yes | Filename patterns used to find the documents. At least one entry is required. Each entry must be nonempty. |
Example: checking a field in OKHAM Memory
The published Memory rule selects documents of kind note under note/*.json. Its assertion is memory.field_validation, with params.check set to FIELD-TYPE. A runner implementing that assertion checks whether the stored value satisfies its resolved field contract. A mismatch produces an error with the rule's message.
Edition 0.2.0 · JSON Schema · Full example