Expand description
The Godot warning catalog + the emit-then-gate seam (Phase-6 Workstream 1).
Severity is a resolved property, not a baked-in one. Inference records a RawWarning
(a code + range + message, no severity); the pure gate function resolves it against
the project’s WarningSettings and the per-file SuppressionMap into a final
Diagnostic (or drops it). Because gate runs downstream of the cached analyze_file
query (in gdscript-ide’s type_diagnostics), editing a warning level never invalidates
inference — the salsa-cacheability invariant (Playbook §6).
WarningCode is the single source of truth for the gateable Godot codes. The public
Diagnostic.code stays a stable String (via WarningCode::as_str) so the wire contract
is unchanged — the enum is internal to gdscript-hir.
Structs§
- RawWarning
- An emitted-but-ungraded warning: the inference layer records these (no severity);
gateresolves each into a finalDiagnosticor drops it. - Suppression
Map - The
@warning_ignore[_start|_restore]suppression spans for one file. A warning is suppressed when its range falls inside a span listing its code. (M0 ships the empty map; the CST walk that populates it lands in W1 M2.) - Warning
Settings - The resolved warning configuration for a project (or the standalone analyzer default). Parsed
from
project.godot’sdebug/gdscript/warnings/*; passed togate.
Enums§
- Since
- The lowest Godot minor a code exists in.
Mastermeans “newer than any stable we bundle as the default model” — gated against the project’s declared engine version. - Warn
Level - Godot’s
WarnLevel(gdscript_warning.h): the resolved severity of a code. - Warning
Code - A gateable Godot GDScript warning code (research/04 §2.2). Internal to
gdscript-hir; the publicDiagnostic.codecarries itsas_strform, so the serialized identity stays a stable string. Adding a variant is a compile error until every table below (as_str,default_level, andALL) covers it.
Functions§
- build_
suppression_ map - Build the per-file suppression map from the parsed CST (Workstream 1 M2): each
@warning_ignore("code", …)suppresses the listed codes over the single following statement/declaration, and a@warning_ignore_start("code")…@warning_ignore_restore("code")pair suppresses a region (EOF-terminated if unrestored). Unknown code names are skipped (the unknown-name meta-diagnostic is deferred — seeTECH_DEBT.md). - bundled_
version - The bundled engine
(major, minor)— the default project version and theSince::Masterthreshold. Parsed fromgdscript_api::godot_version(so it tracks the bundled model, not a hardcoded literal). - gate
- Resolve one
RawWarninginto a finalDiagnostic, or drop it. The only place settings/version/suppression touch a warning — pure, so it is trivially cacheable and testable. Precedence (research/04 §2.3): enable → per-code level → treat-as-errors → scope → suppression. - render_
warning_ reference - Render the Markdown Warning Reference page from the
WarningCodecatalog (Workstream 5 docgen). The single source of truth — a test asserts the committed page matches this output, so the docs can never drift from the code (regenerate withGDSCRIPT_UPDATE_DOCS=1).