Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit95280a384c

README.md

reportFormatter

Filtering and formatting helpers for the world validator's Report. All functions are pure — they return new values without mutating the input.

Exports

  • M.filter(report, opts) -> Report — return a copy with problems filtered by severity, category, source, code, path (Lua pattern), includePlaceholders, limit.
  • M.format(report, format) -> string — render a report. format is one of:
    • "human" (default) — plain-text grouped by bucket.
    • "markdown" — markdown tables, suitable for saving to a .md file or pasting into a PR description.
    • "json" — compact JSON encoding (sorted keys for stable diffs).
    • "summary" — single-line health summary.
  • M.summary(report) -> string — shortcut for the one-line summary.

Filter options

{
    severity = "error" | "warning" | "info",  -- minimum severity (keep this and above)
    category = "structure" | "syntax" | "semantic"
             | "reference" | "schema" | "placeholder",
    source   = "world" | "library:@builtin" | …,
    code     = "structure.missing_required_file",
    path     = "<lua pattern>",               -- string.find pattern, anchored anywhere
    includePlaceholders = boolean,            -- default true
    limit    = number,                        -- cap total problems; sets report.truncated
}

The returned report's counts reflect the filtered set, not the original — so report.ok after filtering means "no errors among the problems that match the filter".

Notes

  • The JSON encoder is a small hand-rolled emitter (sorted keys, no pretty-print). The schema is shallow enough that pulling in a full JSON dependency would be overkill.
  • The markdown table escapes | inside messages so column boundaries remain intact.