Skip to main content

Module lints

Module lints 

Source
Expand description

Shared lint emission for the proto-first (obs-build::codegen) and Rust-first (obs-macros::derive_event) authoring paths.

Decision D8-1 (spec 95 § 5): both paths build a LintInput and call emit_lints. Each LintError carries a stable code (L001..L014) and the same human-readable message regardless of which path produced it; the consumer (codegen.rs / derive_event.rs) formats the errors into either Rust source text or proc_macro2 tokens.

This module has no proc_macro2/quote/syn dep so it can be linked from both an ordinary library crate (obs-build’s codegen path) and a proc-macro crate (obs-macros’s derive path) without pulling each other’s heavy transitive deps.

Structs§

LintError
One lint failure.
LintField
One field’s worth of lint input.
LintInput
Input for the shared lint pass — one event’s worth.

Enums§

LintProtoType
Proto wire type a field declares. The proto-first path fills this from FieldDescriptorProto::r#type; the derive path fills it from the Rust syntactic type via LintProtoType::from_rust_token. When the type cannot be inferred it is Other(_) and the type-checking portion of L014 simply does not fire.

Functions§

emit_cross_event_lints
Cross-event lints — currently L013 (schema_hash uniqueness within a codegen unit). The codegen path passes every event’s (full_name, schema_hash); the derive path runs once per event so it cannot detect collisions and skips L013.
emit_lints
Run every lint in the catalogue against one event. Returns one LintError per violation, in stable code order so generated output is deterministic. Spec 95 § 2.1 (D8-1).