Expand description
Core rule engine for the JSS style checker — spec 018 Rust port.
This crate contains zero binding-specific code. jsslint-cli,
jsslint-wasm, jsslint-r, and jsslint-py are thin marshalling
layers over the types and functions exported here; see
/home/node/.claude/plans/having-the-style-checker-compressed-crown.md
for the full architecture.
Re-exports§
pub use catalogue::lookup as lookup_rule;pub use catalogue::RuleMeta;pub use report::CategoryStatus;pub use report::CategorySummary;pub use report::ComplianceReport;pub use report::Fix;pub use report::FixConfidence;pub use report::Severity;pub use report::SkippedRule;pub use report::Violation;
Modules§
- bib
- BibTeX parsing substrate — spec 018 Phase 2. See
parser.rs’s module docs for the exactbibtexparser-compatibility policy this implements (including thecore/parser.py-specific duplicate-key / duplicate-field re-insertion behavior, which differs from rawbibtexparser). - catalogue
- Rule metadata catalogue — compiled in from
specs/003-jss-rule-catalogue/catalogue.yamlbybuild.rs. - config
- Tool configuration — mirrors
texlint.api.ToolConfig(the fields Phase 4 needs;doi_resolver/--crossrefis an online, opt-in feature explicitly out of scope for this port, see the plan’s network-dependency callout) plustexlint.config’s defaults-then-.jss-lint.toml-then-CLI merge (load). - conformance
- One-page conformance report — mirrors
texlint/report.py(spec 015). Markdown only; HTML/PDF stay Python-only per the porting plan (jinja2 templates + optional WeasyPrint aren’t a good target for this port’s early phases). - diff
jss-lint diffengine + renderers — mirrorstexlint/diff.py(spec 016). Pure comparison over the spec-001--output jsonshape; violations are kept as genericserde_json::Valueobjects (not this crate’s typedViolation) since a diff input can be any spec-001-shaped JSON file, including ones this binary didn’t produce, and every original field must round-trip intorender_json’s output untouched.- engine
- Document assembly + rule-running engine — mirrors
core/engine.py’sparse_document/load_journal/run. - explain
- Rule explanation renderer — mirrors
texlint/explain.py(spec 009). - fixer
- Auto-fix engine — mirrors
core/fixer.pyin full, including the file I/O, atomic write, interactive prompting, and re-validation-by-re-running-the-whole-engine parts of Python’sapply_fixes(deferred in the initial port to a pure-logic subset since a fully assembled rule engine didn’t exist yet; Phase 4 now has one). - html_
output - Author/reviewer HTML renderer — hand-translated from
output/html_output.py‘sauthor.html.j2/reviewer.html.j2(no templating-engine dependency, matching this crate’s existingterminal.rs/sarif.rs/conformance.rsapproach of building output strings directly). Byte-exact output was derived by reading the templates’ Jinja2 whitespace-control semantics ({%- -%}trim markers around the guide-link<td>; every other{% %}tag is not trimmed, since the templates’Environmentdoesn’t settrim_blocks/lstrip_blocks, so untrimmed tags leave their adjacent source newlines/indentation in the output) and cross- checked against realjss-lint --output htmlrenders. - json_
output - Deterministic JSON renderer — mirrors
/workspace/src/texlint/output/json_output.pybyte-for-byte, including two of its quirks (both intentional to preserve parity, not oversights): - lsp
- Pure projections from
Violation/Fixto LSP-shaped plain data — mirrorstexlint/lsp/conversions.py. Deliberately returns plain structs, notlsp_typeswire types: this module has no LSP protocol library dependency, matchingconversions.py’s own design (“importable withoutpygls; the actual LSP server … lives in a sibling module”).jsslint-cli’s protocol-speaking server converts these intolsp_typesstructs for transmission. - report
- Domain model — mirrors
texlint.api(see/workspace/src/texlint/api.py). - rules
- Shared rule infrastructure — spec 018 Phase 2. Ports the parts of
_helpers.pyand per-rule-module helper functions that more than one bib rule needs: citation-scope resolution (_iter_referenced_entries/_collect_cited_keys), theentry_line/entry_violationfactories, and the source-rescan techniquenaming.py/house_style.pyuse to locate a field value’s byte span for aFix(bibtexparser exposes no field-level offsets, onlyentry.start_line). - sarif
- Deterministic SARIF 2.1.0 renderer — mirrors
output/sarif.py(spec 006 contract + the spec 008fixes[]addition). Reusesjson_output::write_valuefor the same Python-json.dumps- compatible serialization (ensure_ascii=Trueescaping,sort_keys=True,indent=2). - terminal
- Terminal renderer — mirrors
output/terminal.py’srich-based rendering for the NON-terminal (piped/redirected stdout) case, which is whatConsole(force_terminal=False, ...)produces whensys.stdoutisn’t a real tty (the overwhelmingly common case: CI, editor-integration subprocess calls,> file.txt). No ANSI color codes are emitted in that case even though the Python source builds[red]...[/red]-style markup —richstrips it down to plain text automatically. Real-terminal (tty) colored output is NOT replicated here; this module only targets the non-tty path. - terms
- Canonical-form lookup tables — embedded from
specs/003-jss-rule-catalogue/terms.json(generated fromtexlint.journals.jss.termsbytools/generate_terms_json.py; run that script and commit the diff wheneverterms.pychanges). - tex
- Tolerant LaTeX parsing substrate — spec 018 Phase 1. Ports
pylatexenc.latexwalker’s node model (node.rs,parser.rs),core/parser.py’s pre-tokenization neutralization (neutralize.rs),pos_to_lineno_colno(position.rs), and_helpers.py’s prose-context classifier (prose.rs).