Classes
Severity
1
▼
Severity level of a lint `Diagnostic`.
A plain `Enum` (matching the codebase's plain-Enum preceden…
Severity
1
▼
Enum
Severity level of a lint Diagnostic.
A plainEnum(matching the codebase's plain-Enum precedent,
e.g. TokenType/LexerMode). It is deliberately NOT an IntEnum:
that avoids accidental integer coercion (Severity.ERROR != 1). The
LSPDiagnosticSeverityinteger is available explicitly via
to_lsp().
Methods
to_lsp
0
int
▼
Return the LSP ``DiagnosticSeverity`` integer for this severity.
The Language …
to_lsp
0
int
▼
def to_lsp(self) -> int
Return the LSPDiagnosticSeverityinteger for this severity.
The Language Server Protocol numbers severities 1 (Error), 2 (Warning), 3 (Information), 4 (Hint). This maps the three lint severities onto the first three.
Returns
int
The LSP severity integer: ERROR -> 1, WARNING -> 2, INFO -> 3.
Diagnostic
6
▼
A single lint finding.
Reuses the existing `SourceLocation` verbatim for
positions — it never intr…
Diagnostic
6
▼
A single lint finding.
Reuses the existing SourceLocation verbatim for
positions — it never introduces a new position type and never extends
Node. For AST-oriented rules the location is the offending node's
node.location; for line-oriented rules (e.g. trailing whitespace) the
rule synthesizes its own SourceLocation.
The runner stampsrule_id and severity from the emitting
rule's class metadata, so they can never drift from the producing rule.
Thread Safety: Frozen and slotted; safe to share across threads.
Attributes
| Name | Type | Description |
|---|---|---|
rule_id |
str
|
Kebab-case id of the rule that produced this diagnostic. |
message |
str
|
Human-readable, single-line description of the violation. |
location |
SourceLocation
|
Position of the violation (reuses |
severity |
Severity
|
Effective severity of this occurrence. |
Methods
to_dict
0
dict[str, object]
▼
Convert to a JSON/LSP-friendly dict.
Named ``to_dict`` to match the establishe…
to_dict
0
dict[str, object]
▼
def to_dict(self) -> dict[str, object]
Convert to a JSON/LSP-friendly dict.
Namedto_dict to match the established serialization.py
convention. severity is serialized to its enum .value string.
Returns
dict[str, object]
A dict with the rule id, message, severity value, and position
fields (line/col plus the full location offsets).
Internal Methods 1 ▼
__str__
0
str
▼
Format as ``file:line:col: [rule-id] message``.
Delegates position formatting …
__str__
0
str
▼
def __str__(self) -> str
Format asfile:line:col: [rule-id] message.
Delegates position formatting to__str__(), so the
file: prefix is omitted when source_fileis unset. Mirrors the
ParseError "file:line:col: message" shape.
Returns
str
A single-line, ready-to-print diagnostic string.