API reference
python:arxjit:arxjit.locations.diagnostic
function diagnostic
diagnostic(extracted: ExtractedSource, node: ast.AST, message: str, severity: DiagnosticSeverity = DiagnosticSeverity.ERROR) -> Diagnostic
Source: packages/arxjit/src/arxjit/locations.py:42
Build a diagnostic located at an ast node.
Reads the node's lineno/col_offset when present and converts the column to the one-based character contract via char_column; falls back to no location when the node carries none. node.lineno is a real file line number (extract_source already shifted it), while extracted.source is indexed from its own first line, so the node's line is looked up at splitlines()[lineno - extracted.lineno] rather than lineno - 1.
Parameters
-
extracted — Type: ExtractedSource
-
node — Type: ast.AST
-
message — Type: str
-
severity — Type: DiagnosticSeverity; Defaults to ERROR, the severity of a rejection.
Returns
Type: Diagnostic