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:37
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 — Extracted Python source and syntax.; Type: ExtractedSource
-
node — Syntax node to process.; Type: ast.AST
-
message — Diagnostic or output message.; Type: str
-
severity — Defaults to ERROR, the severity of a rejection.; Type: DiagnosticSeverity
Returns
Constructed a diagnostic located at an ast node.; Type: Diagnostic